Page 1 of 1

sql problem.. i think..

Posted: Tue Mar 07, 2006 11:57 am
by khuti
hi, im having a spot of bother i think its a sql problem but it mite b my database setup.

basically i have a dynamic list of images table which changes as they delete the images or add them.
i want the list to display in an order so that all the images related to a certain page will be together in a group.

as the images all have there own different id as to when it is added i thought i cant use that as a way to keep them in order so, depending which page they are adding the image for it adds a number 1,2,3,4,5,6,7 or 8 in a field called order so i thought i could do this:

mysql_query("SELECT * FROM pics ORDER BY order ASC");

but it does not work, anybody know why this is? or how i could do it?

id like it to list them so if order = 1

img1
img2

then if order = 2..

img5
img3

then if order = 3

img6
img4

i think u get the jist. not sure the best way to explain myself! anyway thanks for any help in advance..

khuti

Posted: Tue Mar 07, 2006 12:07 pm
by feyd
code? error output? bacon?

Check the output of mysql_error() I have a sneaking suspicion you need to backtick "pics" and "order"

Posted: Tue Mar 07, 2006 12:27 pm
by khuti
hey thanks.. yea i dint realise that was a thing coz sum things work without. now i know its important ta, works fine now :)