Jump to content


Photo

help editing profiles.


  • Please log in to reply
5 replies to this topic

#1 rallokkcaz

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

Posted 03 September 2006 - 02:37 AM

i need help with the code i have for editing the profiles
cause everytime you choose to edit it any one can edit it
pleeze help!!

thanks

ps thanks for all the help with PHP

#2 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 03 September 2006 - 02:40 AM

Man you really need to learn proper spelling and grammar (yes I can see your only 13, I could care less). It will get you more responses. Can you post the code you are using now?

#3 rallokkcaz

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

Posted 03 September 2006 - 02:44 AM

<?
include ("config.php");

if(isset($_GET['id']) && is_numeric($_GET['id']))
{
    $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>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 pokebash_users email='$email', fullname='$fullname' WHERE userid='$userid'";

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

    echo "Successfully updated profile";

}
else
{
    //########REDIRECTS TO YOUR HOME PAGE IF UID IS NOT PRESENT IN THE URL#########
    echo '<meta http-equiv="refresh" content="0;URL=user.php" />';
   }

?>


#4 rallokkcaz

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

Posted 03 September 2006 - 02:54 AM

here's the erorr i get

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='bob@aol.com', fullname='Aay' WHERE userid='6'' at line 1

#5 rallokkcaz

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

Posted 03 September 2006 - 03:05 AM

and i can't seem to figuer out what i did wrong ???




#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 September 2006 - 03:17 AM

1 wrong and corrected
$sql = "UPDATE pokebash_users  set email='$email', fullname='$fullname' WHERE userid='$userid'";

2 wrong corrected always use a diffrent query name from others
$sql2 = "UPDATE pokebash_users email='$email', fullname='$fullname' WHERE userid='$userid'";

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


if your using sessions always have session_start() at the top of every page ok
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users