Well I'd like to select values from fields that are in rows with other 2 values
Code:
$sql="SELECT * FROM forum_question WHERE id='$id', forums_id='$forums_id'";
$result=mysql_query($sql);
After WHERE I used two conditions (matching id and forums_id)
But I get an error
How can I solve the problem?
help with php/sql
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: help with php/sql
You need to replace the comma with AND:
Replace:
With:
Replace:
Code: Select all
$sql="SELECT * FROM forum_question WHERE id='$id', forums_id='$forums_id'";
Code: Select all
$sql="SELECT * FROM forum_question WHERE id='$id' AND forums_id='$forums_id'";
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: help with php/sql
... Duplicate thread?
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: help with php/sql
naughty naughty - tut tut tut