12-08-2007, 01:16 PM
|
#2 (permalink)
|
|
The Wanderer
Join Date: Sep 2007
Posts: 11
Thanks: 0
|
I honestly did not understand one thing that you said...
[edit]
Ahh, nevermind. I see what you mean now.
Well I am not exactly sure how to do this in one query, but you would just run a query to fetch the category, and then use another query to fetch the ads from that category.
PHP Code:
$fetch = mysql_query ( sprintf ( "SELECT order FROM category WHERE category = '%s' LIMIT 1", $categoryName ) );
$row = mysql_fetch_assoc ( $row ); $categoryOrder = $row['order'];
$categoryOrder = implode ( ',', $categoryOrder );
$fetch = mysql_query ( sprintf ( "SELECT * FROM ads WHERE id IN ( %s )", $categoryOrder ) );
while ( $row = mysql_fetch_assoc ( $fetch ) ) {
print_r ( $row );
}
I think that will work, try it and let me know. :)
|
|
|
|