#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    7
    Rep 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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    108
    Rep Power
    15
    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
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    7
    Rep 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");
    }

    ?>
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    26
    Rep 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
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    32
    Rep Power
    15
    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")
    &#0124; &#0124;
    print("Sorry, $Handle isn't available, please Try another Name.");
    ?>

Similar Threads

  1. Problems updating mysql database using Php
    By bassist84 in forum PHP Development
    Replies: 2
    Last Post: January 18th, 2004, 05:26 PM
  2. updating the database
    By mikeridner in forum PHP Development
    Replies: 2
    Last Post: July 15th, 2002, 07:24 PM
  3. updating mysql database
    By buckenmeyer in forum PHP Development
    Replies: 4
    Last Post: July 12th, 2002, 11:09 AM
  4. updating database using input from a email message
    By Projecto EINet in forum Perl Programming
    Replies: 4
    Last Post: November 14th, 2000, 06:58 AM
  5. updating a database using data from a email message
    By Projecto EINet in forum Perl Programming
    Replies: 0
    Last Post: November 26th, 1999, 01:02 PM

IMN logo majestic logo threadwatch logo seochat tools logo