SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2006
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Updating user details.

    Hi Guys,

    i have a page where a user can edit thier details and submit the changes, but the query isn't working correctly i have missed something but don't know what lol

    once the form is submitted it goes to: edit_profile_done.php

    PHP Code:
        $headline mysql_escape_string($_POST['headline']);

       
    // Update Database
       
    $qUpdate "UPDATE membership SET headline='$headline' ";
       
    $qUpdate .= " where username='$username' ";

       
    $rsUpdate mysql_query($qUpdate);

       if (
    $rsUpdate)
       {
        echo 
    "<p>Thank you <i>$username</i> Your Profile Has Been Updated.</p>";

    any help would be appreciated

    Graham

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    include("opendb.php"); //database conection settings
    $headline=time(); //example data
    $username="ernie"//example username
    $headline mysql_escape_string($headline); 

       
    // Update Database 
       
    $qUpdate "UPDATE users SET lastact='$headline' "
       
    $qUpdate .= "WHERE login='$username' "

       
    $rsUpdate mysql_query($qUpdate) or die(mysql_error()); //don't forget to use error checking

       
    if ($rsUpdate
       { 
        echo 
    "<p>Thank you <i>$username</i> Your Profile Has Been Updated.</p>"

    it works, but you should check if the username is sent to the page via session or POST/GET
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2006
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks agtain ernie, worked very well

    thanks mate

    Graham


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •