我对这个简单的 sql 查询有疑问:
<?php
require_once('../../Connections/tohoshows.php');
$show ='gothaf';
mysql_select_db($database_tohoshows, $tohoshows);
$query_getShows = "SELECT * FROM toho_shows WHERE toho_shows.show =' ". $show. " '";
$getShows = mysql_query($query_getShows, $tohoshows) or die(mysql_error());
$row_getShows = mysql_fetch_assoc($getShows);
$totalRows_getShows = mysql_num_rows($getShows);
mysql_free_result($getShows);
?>
当我像这样在 WHERE 子句中直接使用字符串时
$query_getShows = "SELECT * FROM toho_shows WHERE toho_shows.show ='gothaf'";
我得到一个结果。当我改用该变量时,我没有得到任何数据!我是新手,我无法弄清楚我做错了什么。任何帮助,将不胜感激。谢谢!