MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 12th, 2000, 03:14 PM
Stuart Stuart is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 7 Stuart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old July 12th, 2000, 11:14 PM
yoshi yoshi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 108 yoshi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to yoshi
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

Reply With Quote
  #3  
Old July 13th, 2000, 12:03 AM
Stuart Stuart is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 7 Stuart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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");
}

?>

Reply With Quote
  #4  
Old July 14th, 2000, 06:47 PM
rway rway is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 26 rway User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #5  
Old July 14th, 2000, 09:37 PM
Anti Anti is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 32 Anti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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.");
?>

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Updating Database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway