Problem with mysql_query and it's returns

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dashifen
Forum Commoner
Posts: 35
Joined: Thu Feb 05, 2004 9:53 pm
Location: Champaign - Urbana, IL

Problem with mysql_query and it's returns

Post by dashifen »

Code: Select all

$getGameName = mysql_query($gameNameSQL, $db);
$getPCs = mysql_query($PCSQL, $db);
$getNPCs = mysql_query($NPCSQL, $db);

$numPCs = mysql_num_rows($getPCs);
$numNPCs = mysql_num_rows($getNPCs);
$row = mysql_fetch_array($getGameName, MYSQL_ASSOC);
Can anyone tell my why the calls to mysql_num_rows and mysql_fetch_array are saying the the $getPCs, $getNPCs, and $getGameName variables are not a valid msyql result resource? The connection has been made and the correct database has been selected. The query variables are all correct and if I run the queries through phpMyAdmin on the database, they work as expected. But, whe I try to use them from the web, I'm not getting the results I expect.

Thanks,
-- Dave --
User avatar
Saethyr
Forum Contributor
Posts: 182
Joined: Thu Sep 25, 2003 9:21 am
Location: Wichita, Kansas USA
Contact:

Post by Saethyr »

could we see your sql String please? This maybe happening because it is not returning anything.

***EDIT***

Actually this looks like a game, could we see $PCSQL and $NPCSQL strings


Thanks
dashifen
Forum Commoner
Posts: 35
Joined: Thu Feb 05, 2004 9:53 pm
Location: Champaign - Urbana, IL

Post by dashifen »

Saethyr wrote:could we see your sql String please? This maybe happening because it is not returning anything.

***EDIT***

Actually this looks like a game, could we see $PCSQL and $NPCSQL strings


Thanks
Damn it ... I'm dumb. Got it. I had a misspelling on the mysql_select_db() function and didn't ad a die() function after it so I couldn't tell that nothing had been selected.

-- Me --
User avatar
Saethyr
Forum Contributor
Posts: 182
Joined: Thu Sep 25, 2003 9:21 am
Location: Wichita, Kansas USA
Contact:

Post by Saethyr »

happens to everyone man.
Post Reply