Jump to content

Can't get "order by" to work in this string...


jonw118

Recommended Posts

Hi there - can anyone lend me a little advise as to what I'm doing wrong here.

 

I have this line:

$query=mysql_query("SELECT * FROM gallery a JOIN gallery_image b ON a.id = b.gallery_id where gallery_id=$gallery_id");

 

I am trying to add an order by statement: order by gallery_image.priority

 

So I created:

$query=mysql_query("SELECT * FROM gallery a JOIN gallery_image b ON a.id = b.gallery_id where gallery_id=$gallery_id order by gallery_image.priority");

 

But, I receive the error (even though there is table called "Gallery Image" and a column called "Priority":

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/***/public_html/***/gallery.php on line 5
select: Unknown column 'gallery_image.priority' in 'order clause'

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.