I'm running a select statement using an "inner join"(I think lol).
Anyway, I want to add "order by SOMETHING" to the select statement but I keep getting errors. Here is what my select statement looks like. It's a bit complicated but I need it like this.
$query = "SELECT distinct a.* FROM table1 as a, table2 as b WHERE ";
if(!empty($color1) or !empty($color2)or !empty($color3)or !empty($color4))
$query .= " (a.color in('$color1 ','$color2 ','$color3 ','$color4 '))";
if(!empty($book1) or !empty($book2)or !empty($book3)or !empty($book4))
$query .= " AND(a.book in('$book1 ','$book2 ','$book3 ','$book4 '))";
if(!empty($image))
$query .=" AND a.userid = b.userid AND ( b.img_id != 0)";