| Back to top |
hello again tis me got a question about inserting into a database table the current code i have in the function is
:: Code ::
if ($points>=$set_match_val) { $sql = "insert into matchprofiles (username_p1,username_p2,score,highest) values ('".$for_user ."', '$username','$points','$highest')"; $res_ins = query($sql); //echo $sql . "<br>"; } this code inserts the info into the database just fine except it allows the users to submit the same data over and over i would like it to just insert one record then if they come back and use the function again have it check for a record that exists would it be better to delete all the existing records that match username first then insert as new or would a check to see if the username exists then an error message or any other thoughts on this would be helpful Thanks for any insight Regards, Brandon |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 850 Location: East Coast, West Coast? I know it's one of them. |
I would do an error message if exists, then add a feature for the user to update their information if required. Which means a form somewhere for them to change their settings/features etc.
I made a friend of mine a user info program for his site, and that's how I handle that situation, if it exists, error message saying they already are signed up, but there is another page where they can update their information if they want. That works well for us. |
|||||
|
All times are GMT - 8 Hours
|
||||||
Contact Us
Hosting: Pair Networks: 0.049
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info
Hosting: Pair Networks: 0.049
Forum Software © 2001–2006 phpBB
techForum Style © 2003–2006 techpatterns.com
info