我在mysql连接中有错误。它说mysql_query() expects parameter 1 to be string on line 37
mysql_fetch_array()期望参数1为resource,null为null 如下:
$result = mysql_query($link,"SELECT Name, id FROM skoleni WHERE Grupa = '".$_GET['grupa']."';");
while($row = mysql_fetch_array($result))
答案 0 :(得分:2)
mysql_query("SELECT Name, id FROM skoleni WHERE Grupa = '".$_GET['grupa']."';");
无需在mysql query()函数中指定连接参数。 如需进一步参考,请参阅此http://in1.php.net/manual/en/function.mysql-query.php
答案 1 :(得分:0)
$ link不是必需的。试试这个:
`$result = mysql_query("SELECT Name, id FROM skoleni WHERE Grupa = '".$_GET['grupa']."';");
答案 2 :(得分:0)
重要:强>
停止使用mysql_ * api,它已被弃用且通常不好用。请改用PDO或mysqli
尝试
$result = mysqli_query($link,"SELECT Name, id FROM skoleni WHERE Grupa = '".$_GET['grupa']."';");
$rowcount=mysqli_num_rows($result);
if ($rowcount > 0)
{
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
}
}