php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50160 Not Recieving Data From DB
Submitted: 2009-11-12 17:18 UTC Modified: 2010-08-18 12:27 UTC
From: arrshadowman at msn dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.11 OS: Windos XP PRO SP3
Private report: No CVE-ID: None
 [2009-11-12 17:18 UTC] 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","root@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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-12 17:36 UTC] jani@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 19:16 UTC] 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 21:40 UTC] jani@php.net
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..
 [2009-11-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-08-18 12:27 UTC] andrey@php.net
-Status: No Feedback +Status: Bogus
 [2010-08-18 12:27 UTC] andrey@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 10 23:01:30 2024 UTC