我正在尝试使用准备好的mysqli来获取查询的行数,但无法使其正常工作。我尝试对phpMyAdmin的SQL查询,并且可以正常工作。您认为这段代码有什么问题?
$servername = "localhost";
$username = "username";
$password = "pass";
$dbname = "dbname";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$stmt = $conn->prepare("SELECT * FROM Imported WHERE Store = '?' and Product_ID = '?'");
$stmt->bind_param("ss", $store, $product_id);
$store = "store.myshopify.com";
$product_id = "7121";
$stmt->execute();
if ($stmt->num_rows > 0) {
echo "Yes";
} else {
echo $stmt->num_rows ;
}
$stmt->close();
$conn->close();