标题错误的原因是什么?我在mysql前端测试了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");
        }

最佳答案

嗯,试试看它是否在收集任何数据:

$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;

10-08 02:24