标题错误的原因是什么?我在Mysql Front上测试了mysql查询并没有问题。我的脚本如下。谢谢。
$fbFoodPerma = $fbSiteID."-".$fbFoodPerma;
$sql = mysql_query("
SELECT fbFoodPerma
FROM fbFoods
WHERE fbFoodPerma
LIKE '$fbFoodPerma'") or die(mysql_error());
$isStored = mysql_result($sql,0,"fbFoodPerma");
while ($isStored == "$fbFoodPerma") {
$fbFoodPerma = $fbFoodPerma."-";
$sql = mysql_query("
SELECT fbFoodPerma
FROM fbFoods
WHERE fbFoodPerma
LIKE '$fbFoodPerma'") or die(mysql_error());
$isStored = mysql_result($sql,0,"fbFoodPerma");
}
答案 0 :(得分:4)
嗯,试试看它是否正在拾取任何数据:
$sql="SELECT * FROM fbFoods";
$query = mysql_query($sql) or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($query);
if ($num_rows > 0) {
echo "rows found";
} else {
echo "none found";
}
还要确保$fbFoodPerma
实际包含某些内容 - 尝试在查询结束时回显它。
echo $fbFoodPerma;