Two queries in one WHERE clause??
Hello all,
basically, trying to use URL + explode, to query a table..
Using explode to get "1022" from this url:
domain.com/cars.html/1022/
"1022" is in a field called "line"
my table has three fields:
model/make/line
(1983 525e/BMW/1022)
Using this information, I would like to grab only the "model" fields that match the "make" field, using the defined "line" result from explode function??
list($first) = explode('/', substr($PATH_INFO,1));
$query = "SELECT *
FROM `makes-model`
WHERE `line` LIKE '$first'
ORDER BY RAND() LIMIT 4";
$result = mysql_query($query);
$number = mysql_numrows($result);
{
for ($i=0; $i<$number; $i++) {
$make=mysql_result($result,$i,"make");
$model=mysql_result($result,$i,"model");
$line=mysql_result($result,$i,"line");
echo "$model";
}}
Im sure I have done this before..
FROM `makes-model`
WHERE `line` LIKE '$first'
AND model LIKE 'make'
ORDER BY RAND() LIMIT 4";
timjpriebe posted this at 02:08 — 16th March 2005.
He has: 2,667 posts
Joined: Dec 2004
Can you not just use an equal sign instead of NOT? (And, of course, remove the single quotes.)
Renegade posted this at 08:57 — 16th March 2005.
He has: 3,022 posts
Joined: Oct 2002
I don't see where those came from...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.