I have never had this happen before. The query is very simple by the way.
$q = mysql开发者_JAVA百科_query("SELECT * FROM $TABLE");
while($r = mysql_fetch_array($q)) {
echo $r['fieldname'];
}
edit: the first column (row) is skipped. but when I deleted the first column, the second one was ignored.
(SOLVED)
I figured it out. I declared mysql_fetch_array twice.
$q = mysql_query("SELECT * FROM $TABLE");
$r = mysql_fetch_array($q) //over here
while($r = mysql_fetch_array($q)) {
echo $r['fieldname'];
}
I have to be more careful, but thank you very much!
You should always use full list of columns in your select statement. Code you have posted is an example of bad programming. Do it this way
$q = mysql_query("SELECT fieldname FROM $TABLE");
while($r = mysql_fetch_array($q)) {
echo $r['fieldname'];
}
Every thing seems okey, but it worth trying with MYSQL_ASSOC
$q = mysql_query("SELECT * FROM $TABLE");
while($r = mysql_fetch_array($q,MYSQL_ASSOC)) {
echo $r['fieldname'];
}
精彩评论