New Error!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Monopoly
Forum Commoner
Posts: 41
Joined: Wed May 21, 2008 1:19 pm

New Error!!

Post 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?)
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: New Error!!

Post 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.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: New Error!!

Post 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
Post Reply