what is the best approach?
Posted 26 February 2006 - 03:30 PM
The favorites table will have the following fields:
user_id - login id
illustrator_id - the id of the illustrator they want to save as one fo their favorites
date - current date
So I have two questions
[!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--]1. When a user clicks "add favorite" should I have this as an ajax function that processes this request and updates the page without changing the page (if so how do I do this .. or go about learning how to do this).. if not .. I assume I just have a php page that will process this info and return the user back to the page they were previously on.[!--sizec--][/span][!--/sizec--]
[!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--]2. What is the best way to write the sql statement to insert/update this in the database?[!--sizec--][/span][!--/sizec--]
In the past I have wrote multiple SQL statements .. with a series of "if" statements .. but I am sure there is a more effecient way to do this??
What I have been doing is ...
if the table has user_id and artist_id as the primary key
then write a sql statement that UPDATES the table
write a sql statement thatn inserts this info
is there an easy way where you can just write .. insert this info .. and if it exists it overwrites it .. or do you have to do it the way I have been doing it?
Thanks so much
Should I write a few sql statements
Posted 26 February 2006 - 08:15 PM
Posted 27 February 2006 - 02:12 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users