EasyPHP
EN FR
>download >components >modules >blog >forum >faq >screenshots >introduction

For Windows Vista/Seven issues, please read the FAQ or leave a detailed message

Go to Topic: PreviousNext
Go to: Message ListNew TopicSearchLog InPrint View

php mysql_fetch_array returned no rows



Posted by: mamadouabd
June 15, 2009 09:56AM
php mysql_fetch_array returned no rows. But when i submit the query directly to mysql, it returns the data. Here is my code :

include("config.php");

function BuildTable($result) {
$fieldCount = @mysql_num_fields($result);
for ($i=1; $i<$fieldCount; $i++) {
$fieldName = @mysql_field_name($result, $i);
}
$r=@mysql_fetch_array($result); //for testing
if($r != FALSE) //false is always returned although the query works on mysql
print("true");
else
print("false");
while($r=@mysql_fetch_array($result)) {
print("<tr>\n");
$num=@mysql_num_fields($result);
for($i=0;$i<$num;$i++) { //pour chaque champ
if(!is_null($r[$i])) {
if($i != 4) {
if($i == 3) {
print("<td>");
print("<a href='get_fichier.php?Fichier=".$r[4]."'>".$r[$i]."</a>");
print("</td>");
}
else {
print("<td>");
print($r[$i]);
print("</td>");
}
}
}
else
print("<td></td>");
}
print("</tr>\n");
}
}

Options: ReplyQuote


Go to: Message ListSearchLog In
Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.