Page 1 of 1

New Error!!

Posted: Thu Jun 12, 2008 5:27 am
by Monopoly
Code:

$sql="SELECT * FROM forum_question WHERE id='$id', forums_id='$forums_id'";
$result=mysql_query($sql);



Error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5886547/public_html/view_topic.php on line 46

How can I solve the problem? (How can I use multiple WHERE conditions?)

Re: New Error!!

Posted: Thu Jun 12, 2008 5:34 am
by Mordred
Monopoly wrote:How can I solve the problem?
1. Ask in the correct forum (Code or Database, not Theory and Design)
2. Use a descriptive subject
3. Demonstrate that you've made some effort in solving the problem yourself, usually these things really work out when you try to shake them a bit AND it works faster for you, rather than waiting for someone to answer on a forum.


How would you do a similar thing in PHP, in an "if" for example (Hint: &&). Check the MySQL documentation on the equivalent of && in SQL.

Re: New Error!!

Posted: Thu Jun 12, 2008 6:14 am
by superdezign
Monopoly wrote:How can I use multiple WHERE conditions?
WHERE [condition], [condition] <-- Wrong
WHERE [condition] AND [condition] <-- Right
WHERE [condition] OR [condition] <-- Right