Jump to content


Photo

need edit profile script (old one doesn't work)


  • Please log in to reply
4 replies to this topic

#1 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 12 September 2006 - 10:42 PM

ok i need a edit profile script

what gets the users info just from where hes logged in

so if user1 went to edit profile whent to edit his profile it would show only his info
and if user2 click on that link it would take it to his info not user1's

here's the code i use now.

<?php

    $id = $_GET['id'];

    $sql = "SELECT * FROM maaking_users WHERE userid='$id'";

    $result = @mysql_query($sql) or die(mysql_error());

    $user = mysql_fetch_assoc($result);
    echo <<<HTMLFORM
<form action="{$_SERVER['PHP_SELF']}" method="post">
<table  cellpadding="2" cellspacing="1" width="400">
  <tr>
    <td wdith="35%">Username:</td>
    <td>{$user['username']}</td>
  </tr>  
  <tr>
    <td>Full Name:</td>
    <td><input type="text" name="fullname" value="{$user['fullname']}" /></td>
  </tr><tr>
    <td>Password</td>
    <td>
New Password: <input type="password" name="password" value="$password" /></td>
  </tr>
 <tr>
    <td>About Me:</td>
    <td><textarea height="200px" width="300px" input type="text/html"  name="about" value="" />{$user['about']}</textarea></td>
  </tr><tr
  <tr>
    <td>Email Address:</td>
    <td><input type="text" name="email" value="{$user['email']}" /></td>
  </tr>
  <tr>
    <td colspan="2">
      <input type="hidden" name="userid" value="{$user['userid']}" />
      <input type="submit" name="update" value="Update Profile">
    </td>
  </tr>
</table>
</form>
HTMLFORM;
}
elseif(isset($_POST['update']))
{
    foreach($_POST as $field_name => $field_value)
    {
        ${$field_name} = mysql_real_escape_string($field_value);
    }

    $sql = "UPDATE maaking_users  set password='$password', about='$about', email='$email', fullname='$fullname' WHERE userid='$userid'";

    $result = mysql_query($sql) or die(mysql_error());

    echo "Successfully updated profile <br>
<a href='profiles.php?id=$userid'>Go to Profile</a>";

 
} 
?>
*note code is missing some info*

#2 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 12 September 2006 - 10:56 PM

? anyone know ? ?????? ¿?¿?¿?¿?¿?

#3 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 12 September 2006 - 11:04 PM

i give up!!  >:(

ive been trying at this for 2 weeks now

:'(

im done

#4 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 12 September 2006 - 11:07 PM

Well, your code does not only miss some info, but some code as well.  E.g. how can you do an } elsif when there is no preceeding IF { statement?
So if you want help, you'd better show all your code statements.

Ronald  8)


RTFM is an almost extinct art form, it should be subsidized.

#5 rallokkcaz

rallokkcaz
  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts
  • LocationSomewhere, CA (Cactus Area)

Posted 12 September 2006 - 11:12 PM

ok
here's what i need

here are the rows in my mysql table

user
password
about
fullname
email

can someone build a form for that thanks

it doesn't need to be complete i'll finish it




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users