我正在尝试从表单中读取一些数据,然后使用php使用它们。我在我的php文件中只使用了mysqli,但是我得到了一些警告,我不明白为什么。这是一些代码:
<?php
// Connects to your Database
$con = mysqli_connect("localhost", "root", "password", "database");
error_reporting(E_ALL);
ini_set('display_errors', 1);
$all_string = $_GET['name'];
if($all_string == NULL) exit("Nothing is written\n");
echo "$all_string"."<br/>";
$tok = strtok($all_string, ",");
$sql = "SELECT * FROM Suggrammata";
/*line 22*/$results = mysqli_query($sql, $con);
/*line 24*/while($is = mysqli_fetch_array($results))
{
.
.
.
?>
以下是警告:
Warning:
mysqli_query() expects parameter 1 to be mysqli, string given in
/var/www/php_anazhthshs/euresh_suggrammatwn_aplh.php on line 22
Warning:
mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given
in/var/www/php_anazhthshs/euresh_suggrammatwn_aplh.php on line 24
你能帮忙吗?提前谢谢!