|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hey guys, I'm having issues with some MySQL code in PHP. I'm running
MySQL-nt 3.23.38, PHP 4.4.1 and Apache 2.0.55 under Windows XP SP2. I'm just running these as my local development platform. I've been using this DB for some time now without any problems, until recently when I needed to add a couple of new tables. I've added the tables fine (they are the same type as all the other tables in the DB) but I can not select the new tables in PHP. It's the exact same code I've used to fetch data from the older tables but it just won't do it for the new tables... I'm pulling my hair out. ;-) Examples... //old (working) code: $query = "SELECT * FROM brokers"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); //new code: $query = "SELECT * FROM locations"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); I've also tried $result = mysql_query("SELECT * FROM cities"); instead of using $query var, same result. The new query returns false for some reason. What makes me think it's a PHP problem is that I can run MySQLFront and run the exact same query just fine and fetch the data, it all seems to work fine outside of PHP. Is my version of PHP a little screwy? Maybe needs updating? Any ideas? Thanks. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"masterx" <masterx@anonymous.org> wrote in message
news:138e0ff1bbefq04@corp.supernews.com... > Sorry, no actual errors are reported (even after setting > error_reporting(E_ALL) the query simply returns false and I get two> warnings about the invalid mysql result resource when I try to use > $result... echo mysql_error(); -- Richard. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
masterx wrote:
> Richard wrote: >> "masterx" <masterx@anonymous.org> wrote in message >> news:138duk2642c7pf8@corp.supernews.com... >>> Hey guys, I'm having issues with some MySQL code in PHP. I'm running >>> MySQL-nt 3.23.38, PHP 4.4.1 and Apache 2.0.55 under Windows XP SP2. >>> I'm just running these as my local development platform. >>> >>> I've been using this DB for some time now without any problems, until >>> recently when I needed to add a couple of new tables. I've added the >>> tables fine (they are the same type as all the other tables in the >>> DB) but I can not select the new tables in PHP. It's the exact same >>> code I've used to fetch data from the older tables but it just won't >>> do it for the new tables... I'm pulling my hair out. ;-) >>> >>> Examples... >>> >>> //old (working) code: >>> $query = "SELECT * FROM brokers"; >>> $result = mysql_query($query); >>> $num_rows = mysql_num_rows($result); >>> >>> >>> //new code: >>> $query = "SELECT * FROM locations"; >>> $result = mysql_query($query); >>> $num_rows = mysql_num_rows($result); >>> >>> I've also tried >>> $result = mysql_query("SELECT * FROM cities"); >>> instead of using $query var, same result. The new query returns false >>> for some reason. What makes me think it's a PHP problem is that I can >>> run MySQLFront and run the exact same query just fine and fetch the >>> data, it all seems to work fine outside of PHP. Is my version of PHP >>> a little screwy? Maybe needs updating? Any ideas? >>> >>> Thanks. >> >> Check the error message that is returned, that will give you (and us) >> more clues.... >> >> Richard >> > > Sorry, no actual errors are reported (even after setting > error_reporting(E_ALL) the query simply returns false and I get two> warnings about the invalid mysql result resource when I try to use > $result... > > Warning: mysql_num_rows(): supplied argument is not a valid MySQL result > resource in D:\Apache\Apache2\htdocs\NewNationwide\nwl\nwadmin .php on > line 473 > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL > result resource in > D:\Apache\Apache2\htdocs\NewNationwide\nwl\nwadmin .php on line 476 I sorted it out, sorry, it turned out to be one of those brain fade occasions... I created the tables in the wrong DB... idiot!!! :P Note to self: delete old DB's that you no longer use and have similar names to your active DB's! Thanks anyway. |
|
![]() |
| Outils de la discussion | |
|
|