I'm new here, yea this looks like i'm just fishing info and leaving.. Well it doesn't have to be so.
Ok what ever.
My problem is this:
I have an ad website under developement and it has multiple gategories where same ad can be. But the order is always different. So how could this have been done?
I have idea like this in mysql tables:
-- Categories --
category (the name like sport, horses, dogs...)
order (helds numbers wich will be the ids of ads.)
-- Ads --
My function will use this -> Mainos('category'); So it will print all ads in order wich is told in category table in order row of the category. And it will start new row allways after colspan total = 3
I hope someone understood what I asked and is able to help me :)
$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. :)
I am sorry for long unactivity on this topic. I have my own reasons for that.
I tested now your way to do it and well firstly it gave me 3 errors, about first mysql_fetc_assoc, well repaired that.
Also it gave error that implode has bad arguments and it also yelled me about the last mysql_fetch_assoc function.
$q = mysql_query ( sprintf ( "SELECT jarjestys FROM kategoria WHERE nimi = '%s' LIMIT 1", $kategoria ) );
$rivi = mysql_fetch_assoc ($q);
$jarjestys = $rivi['jarjestys'];
$jarjestys = implode("," , $jarjestys);
$fetch = mysql_query ( sprintf ( "SELECT * FROM mainos WHERE id IN ( %s )", $jarjestys ) );