我只是想知道如何解决这个问题。在我的数据库中:here我的值为123.我的代码正在搜索它,但它找不到它。
<html>
<head>
<?php
$userid = 123;
$con = mysqli_connect("","","*","");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
echo "Connected";
}
echo "123";
// Perform queries
$sql_fetch_id = "SELECT * FROM AccessedIds WHERE 64id = '123";
$query_id = mysqli_query(sql2242953, $sql_fetch_id);
if(mysqli_num_rows($query_id) ==0) {
echo "empty";
}else{
echo "full";
}
mysqli_close($con);
?>
<title>PHP Test</title>
</head>
<body>
</body>
</html>
答案 0 :(得分:0)
答案 1 :(得分:0)
您的查询和查询字符串错误。您在查询字符串中缺少单引号(&#39;)。见以下陈述:
$sql_fetch_id = "SELECT * FROM `AccessedIds` WHERE `64id` = '123'";
$query_id = mysqli_query($con, $sql_fetch_id);
希望这有帮助。