PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.comp.lang.php > , can't select??
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
, can't select??

Réponse
 
LinkBack Outils de la discussion
Vieux 01/07/2007, 01h52   #1 (permalink)
masterx
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut , can't select??

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.
  Réponse avec citation
Vieux 01/07/2007, 02h24   #2 (permalink)
rf
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: , can't select??

"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.


  Réponse avec citation
Vieux 01/07/2007, 02h31   #3 (permalink)
masterx
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: , can't select??

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h54.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08996 seconds with 11 queries