Question about MySQL query... I think.
Posted 10 July 2006 - 06:57 PM
I have a table. i want to be able to do a query where the url will say art.php?medium=photo , and it will show only photos instead of drawing ands what not. Not the table already has the rows set up, for this to work... I believe. Ive been researching this so I got a concept but its hard to find exactualy what you want if you dont know what its call. Also, how would you make it so that the return is in order by newest to oldest. Thanks for the help!
Posted 10 July 2006 - 08:18 PM
For your project you'll need to use the $_GET PHP superglobal to fetch the "?medium=photo" portion (I don't know if you knew that already). Your MySQL table, at minimum, will need a TIMESTAMP (or DATETIME) field, probably an ENUM field for the "drawing," "photo," etc. categorization, a VARCHAR field for the title, and, if you have user-submitted artwork, some level of unsigned integer to correlate to the user id.
A query on your hypothetical table might look something like this:
SELECT * FROM artwork WHERE type='Photo' ORDER BY date;
You also must decide if you want to store the image in the database or in a file on the server in which case you'll either need to store the filename or name the file according to the database entry's id.
Posted 10 July 2006 - 08:28 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users