Jump to content

not valid SQL?


DarthViper3k

Recommended Posts

ok

 

I\'ve spent the better part of.... all day coding some PHP pages for my project (Private Messaging System.. Inbox and Send Private Message..... each are bout 150 or 200+ lines of code)

 

brain... fried....

need extra pair of eyes to debug

 

error

Warning: Supplied argument is not a valid MySQL result resource in c:apachehtdocs3kphpInbox.php on line 40

 

block of code with error

[php:1:decfc04bb6]

while($pmnum = mysql_fetch_array($result)){ //line 40

if(mysql_num_rows($result) == 0) {

echo(\"You don\'t have any Messages\");

} else {

print(\"<TR><TD WIDTH=\'25%\'>\");

echo $pmnum[from];

print(\"</TD> <TD WIDTH=\'50%\'>\");

echo $pmnum[subject];

print(\"</TD> <TD WIDTH=\'25%\'>\");

echo $pmnum[sent];

print(\"</td></TR>\");

}

}

[/php:1:decfc04bb6]

Link to comment
Share on other sites

your query ( not listed ) didn\'t return any results...  :shock: does it work if you ad hoc it? any syntax errors?

 

thats the only error I got....

 

didn\'t think about adding some rows to the database to see if it actually works

 

I\'m gonna try that

 

that is what your sayin right?

 

edit...

now I got that same error on line 15 as well as the above posted error

 

[php:1:fd6390f548]

$limit = 15;

$messages = \"SELECT users FROM messages WHERE to=\'$username\'\";

$getmessages = mysql_query($messages);

$pmnum = mysql_num_rows($getmessages); //line 15

[/php:1:fd6390f548]

Link to comment
Share on other sites

I guess the problem is either with ur connection string or ur query

 

Try to run the query seperately and see whether u get any values.

 

$link = mysql_connect(\"localhost\", \"username\", \"password\");

mysql_select_db(\"database\", $link);

 

 


mysql_query($messages) or die("problem here ");

Link to comment
Share on other sites

uhh

 

ok

this makes no sense

 

I got a 500 Internal Server Error

 

I have no idea whats goin on

 

edit: nevermind

the error is gone

however...

my old error remains

 

ok

this makes a lot of sense

I remove the or die(); part and it works fine

 

edit

ok

I added more of the code and I have that same error

 

Warning: Supplied argument is not a valid MySQL result resource in c:apachehtdocsmysqlqtest.php on line 7

 

[php:1:ac080681c1]

$messages = \"SELECT users FROM messages\";

$getmessages = mysql_query($messages);

$pmnum = mysql_num_rows($getmessages); // line 7

[/php:1:ac080681c1]

 

what exactly is goin on?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.