ID: 50160 Updated by: j...@php.net Reported By: arrshadowman at msn dot com -Status: Open +Status: Feedback Bug Type: MySQL related Operating System: Windos XP PRO SP3 PHP Version: 5.2.11 New Comment:
This page has very good example, try it out: http://www.php.net/manual/en/function.mysql-fetch-assoc.php The mysql errors should explain you why it fails. Then we can bogus this report since there really isn't any bug here.. Previous Comments: ------------------------------------------------------------------------ [2009-11-12 19:16:15] arrshadowman at msn dot com As instructed in the email, I attempted the var_dump($row) it returns 'bool(false)'. which is what I thought, it isn't returning anything. The mysql_ping($con) is returning true, so it's connecting without errors, but not excepting anything back from the call. According to the 'php.ini' setting that php error log is ON, but has no file name. PHP was installed using the Windows installer for IIS from the www.php.net website for non-threading so the installation was by the default settings. The MySQL COMMAND LINE CLIENT currently is the only access I have to the database. I was hoping to be able to test my website on this developer PC I setup, before uploading it, but this problem is holding me up. I search all over the web for settings advice but didn't find much. But the strange part is that most of the php mysql functions are working except for mysql_query. I'm at a loss. ------------------------------------------------------------------------ [2009-11-12 17:36:13] j...@php.net Try to var_dump($row); instead to see what it contains, if nothing. And check your error log for any possible errors/warnings/notices. (assuming you have setup PHP properly to put all those in an error log file..) ------------------------------------------------------------------------ [2009-11-12 17:18:35] arrshadowman at msn dot com Description: ------------ I'm running a developer setup on my PC. PHP 5.211 and MySQL 5.1 with Windows IIS. For some reason I can run direct queries on the MySQL Command Line Client, but using PHP in IE and FireFox, the query does send anything back. It connects to the database, as the ID counter increments everytime I load the page, but the table data returns nothing. Reproduce code: --------------- --- >From manual page: function.mysql-query#Return Values --- $con = mysql_connect("localhost","r...@localhost",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("nsc_db", $con); $result = mysql_query("SELECT * FROM emails", $con); while ($row = mysql_fetch_array($result)); { echo $row['fname']."<BR>".$row['lname']."<BR>".$row['address']."<BR>".$row['age']; } Expected result: ---------------- The full list from table 'emails'. Actual result: -------------- nothing but the <BR> carriage returns. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50160&edit=1