我正在尝试使用以下 PHP 代码将信息添加到 MySQL 表中。(从 HTML5 基本 Web 表单输入名称和文本。)可能是语法问题?
<?php
include "dbinfo.php"; //contains mysqli_connect information (the $mysqli variable)
//inputs
$name = $_GET["name"];
$text = $_GET["text"];
$sqlqr = 'INSERT INTO `ncool`.`coolbits_table` (`name`, `text`, `date`) VALUES ("$name", "$text", CURRENT_TIMESTAMP);'; //the query. I'm pretty sure that the problem is a syntax one, and is here somewhere.
mysqli_query($mysqli,$sqlqr); //function where the magic happens.
?>
没有错误被抛出。结果是一个空白屏幕,并且将带有“$name”和“$text”的行添加到 MySQL 表中。