|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I have a table Named 'users' and in that table I have the users 'Handle' & 'Password' stored. I need to let the users update their information via forms. Such as 'FirstName' 'LastName' 'Email' etc. Can anyone show me how to update the data?
I have the form complete and it can send over the fields listed above, I just need to be able to process that info and update. |
|
#2
|
|||
|
|||
|
Hello.
I am sorry that I am not helping you directly, but here is what I can tell you: There are great (simple) open-source PERL/MySQL combo scripts located at http://www.odbsoft.com/cook/sources.htm that can teach you through their examples how to add to a database (using forms). I hope this helps you out! Good Luck! yoshi datera@datera.com http://www.datera.com |
|
#3
|
|||
|
|||
|
Thank for that info, it's a little confusing as I forgot to say that I'm using php with MySQL.
Here's the code that doesn't work. It's been kind of hashed together from other working scripts. <?php $db = mysql_connect("localhost", "domain", "password"); mysql_select_db("database",$db); $result = mysql_query("SELECT * FROM users WHERE Handle LIKE '$Handle'",$db); if ($myrow = mysql_fetch_array($result)) { do { printf ("Sorry, $Handle isn't available, please Try another Name."); } while ($myrow = mysql_fetch_array($result)); } else { mysql_query ("UPDATE INTO users (FirstName, LastName, City, Country) VALUES ('$FirstName', '$LastName', '$City', '$Country') "); printf ("Thank you, your info has been updated"); } ?> |
|
#4
|
|||
|
|||
|
Stuart,
Try posting in the PHP forum. You will get a better restonse. I would help, but Iam trying to achieve the same myself. Richard |
|
#5
|
|||
|
|||
|
I don't totally understand what you're trying to do, but I think something like this is what you're getting at...
<? @mysql_pconnect("localhost","user","pass") && @mysql_select_db("database") && @mysql_query("select count(*) from users where Handle='$Handle'") && @mysql_query("update users set FirstName='$FirstName',LastName='$LastName',City='$City',Country='$County' where Handle='$Handle' and Password='$Password'") && print("Thank you, your info has been updated") | | print("Sorry, $Handle isn't available, please Try another Name."); ?> |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Updating Database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|