Results 1 to 15 of 15
Threaded View
-
04-30-2004, 01:31 PM #1Newbie
- Join Date
- Apr 2004
- Posts
- 7
Multiple Condition SELECT query (MySQL + PHP)
How should one select a row with multiple conditions?
i.e. A table (table) has the columns id, category, feature, and text.
How could you do SELECT text FROM table WHERE category = 'news' AND feature = 'computers' ?
Would that be a correct query?
Here's what I have in my script, and it seems to only take the first conditon:
PHP Code:$mtgrabdba = "SELECT template_id FROM mt_template WHERE template_blog_id = '" . $getmtbid['0'] . "' AND template_type = 'archive'";
$mtgrabdbares = mysql_query($mtgrabdba) or die("Could Not Perform Query Because".mysql_error());
$mtdbaid = mysql_fetch_array($mtgrabdbares);
$mtgrabca = "SELECT template_id FROM mt_template WHERE template_blog_id = '" . $getmtbid['0'] . "' AND template_type = 'category'";
$mtgrabcares = mysql_query($mtgrabdba) or die("Could Not Perform Query Because".mysql_error());
$mtcaid = mysql_fetch_array($mtgrabcares);
$mtgrabiea = "SELECT template_id FROM mt_template WHERE tem[plate_blog_id = '" . $getmtbid['0'] . "' AND template_type = 'individual'";
$mtgrabieares = mysql_query($mtgrabdba) or die("Could Not Perform Query Because".mysql_error());
$mtieaid = mysql_fetch_array($mtgrabieares);
Can anyone help?
I can post the INSERT queries I use those values in if necessary.