Forum Moderators: coopster
mysql_fetch_array(): supplied argument is not valid MySQL result resource
it sounds like your query is messed up. Whatever you are passing to mysql_fetch_array is not usable. Try echo'ing the query you are passing to see if there is something visibly wrong. You can even paste the exact output into the command line to make sure.
Would mysql_fetch_array only grab one row of info?
It will return an array that is all the fields from 1 returned row. You need to loop it to get all of the rows. It will return false when there are no more rows.
I have the mysql_fetch_array in a while loop:
while($row = mysql_num_array($sr)) {
echo '<tr>';
for($i = 0; $i < count($row); $i++) {
echo '<td>'.$row[$i].'</td>';
}
echo '</tr>';
}
I still cant seem to figure out what I am missing, could this error be because my while is not correct?
[edited by: Knowles at 6:06 pm (utc) on Feb. 16, 2004]
while($row = mysql_fetch_array($sr)) {
echo '<tr>';
for($i = 0; $i < count($row); $i++) {
echo '<td>'.$row[$i].'</td>';
}
echo '</tr>';
}
you don't need to count($row), this will do, but is that what's creating that error? try:
$sr=mysql_query("select id where....");echo '<tr>';
while($row = mysql_fetch_array($sr)) {
echo '<td>'.$row['id'].'</td>';
}
echo '</tr>';
$sql = "SELECT ID FROM helpdesk WHERE ERROR LIKE '%F%' OR COMMENT LIKE '%F%'";
$sr = mysql_query($sql);
while($row = mysql_fetch_array($sr)) {
echo '<tr>';
for($i = 0; $i < count($row); $i++) {
echo '<td>'.$row[$i].'</td>';
}
echo '</tr>';
}