| | |
mysql_fetch_array Not working at all
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 33
Reputation:
Solved Threads: 1
Hi,
I have this strange problem, I select some data from the database, there is no problem in the query and even when I use mysql_num_rows on the query it gives me the right number of entries in the table I'm selecting from, but when I try to echo every row it echos empty values... what is the problem??
I have this strange problem, I select some data from the database, there is no problem in the query and even when I use mysql_num_rows on the query it gives me the right number of entries in the table I'm selecting from, but when I try to echo every row it echos empty values... what is the problem??
PHP Syntax (Toggle Plain Text)
$sql = "SELECT * FROM table"; $query = mysql_query($sql) or die(mysql_error()); $row_number = mysql_num_rows($query); while ($row = mysql_fetch_array($query)) { echo "row= ".$row["id"]; }
Last edited by theighost; Jul 13th, 2009 at 11:36 am.
•
•
Join Date: Mar 2008
Posts: 217
Reputation:
Solved Threads: 4
is it Giving any Erro?
what if u try this
what if u try this
php Syntax (Toggle Plain Text)
while ($row = mysql_fetch_array($query)) { $id=$row['id']; echo "row= $id "; }
•
•
Join Date: Jan 2009
Posts: 33
Reputation:
Solved Threads: 1
PHP Syntax (Toggle Plain Text)
mysql_connect('server','user','pass'); mysql_select_db('database'); $sql = "select * from table"; $query = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($query)) { $search_row = $row['id']; echo $search_row; }
Thats good you solved it. But this $row is an array. So making it 0 is a bit strange. What other thing you can do is, you can declare it as an empty array:
php Syntax (Toggle Plain Text)
$row = array(); $row = mysql_fetch_array(); // Proceed with rest of the code
![]() |
Similar Threads
- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result (PHP)
- Dynamic drop down list not working (JavaScript / DHTML / AJAX)
- Ajax script not working on firefox (JavaScript / DHTML / AJAX)
- Update sql not working (PHP)
- Warning: mysql_fetch_array (MySQL)
- Loop not working (PHP)
- paging related i have got this error Warning: mysql_fetch_array(): supplied argument (PHP)
- mysql_fetch_array(): supplied argument is not a valid MySQL (PHP)
- MySQL update not working (PHP)
- mysql_fetch_array problem (PHP)
Other Threads in the PHP Forum
- Previous Thread: image upload error!
- Next Thread: How to use pagination of searched records
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time display dynamic echo email error file files folder form forms function functions gc_maxlifetime global google host href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail memmory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php problem query radio random recourse recursion regex registrationform remote script search seo server sessions sms soap source space sql static syntax system table tutorial update upload url validator variable video web webdesign wordpress xml youtube






