Msqli_query“查询错误”

时间:2017-01-16 17:47:29

标签: php mysql mysqli

$server = "xxxxxxx";
$username = "xxxxxx";
$password = "xxxxxx";
$dbname = "xxxxxx";

$conn = new mysqli($server, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$query = "SELECT * FROM Figli WHERE idgenitore = $idgenitore"; 
$result = mysqli_query($conn, $query) or die ("Error in query: $query. ".mysql_error()); 
while ($rows = mysql_fetch_array($result))
{
    //do stuff
}

当我使用mysql_query($ query)时一切都很好,当我迁移到mysqli时问题开始了,现在我有了 “查询错误:SELECT * FROM Figli WHERE idgenitore = admin。”

0 个答案:

没有答案