Unable to jump to row 0 on MySQL result index 13
What is the reason of the error on title? I test开发者_StackOverflow中文版ed mysql query at Mysql Front and no problem. My script is below. Thank you.
$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");
}
Hmm, try this to see if it is picking up any data at all:
$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";
}
Also make sure that $fbFoodPerma
actually contains something - try echoing it at the end of your query.
echo $fbFoodPerma;
精彩评论