Page 5 of 5 FirstFirst 12345
Results 41 to 49 of 49
  1. #41
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    PHP Code:
    <?php

    $query 
    mysql_query"SELECT * FROM `users` WHERE `username` = '$grab_username'" );
    $value mysql_fetch_array$query );

    if(
    $_GET ['do'] == 'update') {
        
    $fname htmlspecialchars$_POST ['firstname'] );
        
    $lname htmlspecialchars$_POST ['lastname'] );
        
    $nname htmlspecialchars$_POST ['nickname'] );
        
    $location htmlspecialchars$_POST ['location'] );
        
    $email htmlspecialchars$_POST ['email'] );
        
    $gender htmlspecialchars$_POST ['gender'] );
        
    $bio htmlspecialchars$_POST ['bio'] );
        
    $fmovies htmlspecialchars$_POST ['favmovies'] );
        
    $fmusic htmlspecialchars$_POST ['favmusic'] );
        
    $fbooks htmlspecialchars$_POST ['favbooks'] );
        
        
    mysql_query"UPDATE `users` SET `firstname`='$fname', `lastname`='$lname', `nickname`='$nname', `location`='$location', `email`='$email', `gender`='$gender', `bio`='$bio', `favouritemovie`='$fmovies', `favouritemusic`='$fmusic', `favouritebooks`='$fbooks' WHERE `username`='$grab_username'" ) or die( mysql_error() );
        
        echo 
    "congrats, you have updated your info.";
        echo 
    "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"5\"; URL=\"index.php\">";
    }

    if(
    $_GET ['do'] == 'updatepw') {
        
        
    $currentpassword mysql_query"SELECT `password` FROM `users` WHERE `username` = '$grab_username'" );
        
    $newpassword $_POST ['newpassword'];
        
    $newpassword md5$newpassword );
        
        if(
    $currentpassword != $value ['password']) {
            echo 
    "sorry, but the password you entered does not match your current one.";
        } else {
            
    mysql_query"UPDATE `users` WHERE `password` = '$newpassword'" );
            echo 
    "congrats, you have updated your password.";
            echo 
    "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"5\"; URL=\"index.php\">";
        }
    } else {
        
    ?>

    <form action="?do=update" method="post">
        first name: <input type="text" name="firstname" value="<?php echo $value['firstname'?>" />
        <br/>
        last name: <input type="text" name="lastname" value="<?php echo $value['lastname'?>" />
        <br/>
        nick name: <input type="text" name="nickname" value="<?php echo $value['nickname'?>" />
        <br/>
        location: <input type="text" name="location" value="<?php echo $value['location'?>" />
        <br/>
        email: <input type="text" name="email" value="<?php echo $value['email'?>" />
        <br/>
        gender: <input type="radio" name="gender" value="male" />male <input type="radio" name="gender" value="female" />female
        <br/>
        bio: <input type="text" height="200px" width="300px" name="bio" value="<?php echo $value['bio'?>" />
        <br/>
        fav movies: <input type="text" height="200px" width="300px" name="favmovies" value="<?php echo $value['favmovies'?>" />
        <br/>
        fav music: <input type="text" height="200px" width="300px" name="favmusic" value="<?php echo $value['favmusic'?>" />
        <br/>
        fav books: <input type="text" height="200px" width="300px" name="favbooks" value="<?php echo $value['favbooks'?>" />
        <br/>
        <input type="submit" value="update profile" />
    </form>
    <br/>
    <br/>
    want to change your password?
    <form action="?do=updatepw" method="post">
        current password: <input type="password" name="currentpassword" />
        <br/>
        new password: <input type="password" name="newpassword" />
        <br/>
        <input type="submit" value="update password" />
    </form>

    <?php
    }
    ?>

  2. #42
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    It still doesn't update. :S

  3. #43
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    does the "congrats you have.." come up?

  4. #44
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    yes, it does.

  5. #45
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    Something tells me you should buy "PHP for Dummies", as all this is very basic stuff. Honestly.

    Not insulting you are anything, just I think you need to spend more time leaning by yourself rather than getting the community to spoon feed it to you.


    www.fragme.co = a project.

  6. #46
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    try this code, and tell me what displays..

    PHP Code:
    <?php

    $query 
    mysql_query"SELECT * FROM `users` WHERE `username` = '$grab_username'" );
    $value mysql_fetch_array$query );

    if(
    $_GET ['do'] == 'update') {
        
    $fname htmlspecialchars$_POST ['firstname'] );
        
    $lname htmlspecialchars$_POST ['lastname'] );
        
    $nname htmlspecialchars$_POST ['nickname'] );
        
    $location htmlspecialchars$_POST ['location'] );
        
    $email htmlspecialchars$_POST ['email'] );
        
    $gender htmlspecialchars$_POST ['gender'] );
        
    $bio htmlspecialchars$_POST ['bio'] );
        
    $fmovies htmlspecialchars$_POST ['favmovies'] );
        
    $fmusic htmlspecialchars$_POST ['favmusic'] );
        
    $fbooks htmlspecialchars$_POST ['favbooks'] );
        
        exit(
    "grab_username: {$grab_username}");
        
        
    mysql_query"UPDATE `users` SET `firstname`='$fname', `lastname`='$lname', `nickname`='$nname', `location`='$location', `email`='$email', `gender`='$gender', `bio`='$bio', `favouritemovie`='$fmovies', `favouritemusic`='$fmusic', `favouritebooks`='$fbooks' WHERE `username`='$grab_username'" ) or die( mysql_error() );
        
        echo 
    "congrats, you have updated your info.";
        echo 
    "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"5\"; URL=\"index.php\">";
    }

    if(
    $_GET ['do'] == 'updatepw') {
        
        
    $currentpassword mysql_query"SELECT `password` FROM `users` WHERE `username` = '$grab_username'" );
        
    $newpassword $_POST ['newpassword'];
        
    $newpassword md5$newpassword );
        
        if(
    $currentpassword != $value ['password']) {
            echo 
    "sorry, but the password you entered does not match your current one.";
        } else {
            
    mysql_query"UPDATE `users` WHERE `password` = '$newpassword'" );
            echo 
    "congrats, you have updated your password.";
            echo 
    "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"5\"; URL=\"index.php\">";
        }
    } else {
        
    ?>

    <form action="?do=update" method="post">first name: <input type="text"
        name="firstname" value="<?php
        
    echo $value ['firstname']?>" /> <br />
    last name: <input type="text" name="lastname"
        value="<?php
        
    echo $value ['lastname']?>" /> <br />
    nick name: <input type="text" name="nickname"
        value="<?php
        
    echo $value ['nickname']?>" /> <br />
    location: <input type="text" name="location"
        value="<?php
        
    echo $value ['location']?>" /> <br />
    email: <input type="text" name="email"
        value="<?php
        
    echo $value ['email']?>" /> <br />
    gender: <input type="radio" name="gender" value="male" />male <input
        type="radio" name="gender" value="female" />female <br />
    bio: <input type="text" height="200px" width="300px" name="bio"
        value="<?php
        
    echo $value ['bio']?>" /> <br />
    fav movies: <input type="text" height="200px" width="300px"
        name="favmovies" value="<?php
        
    echo $value ['favmovies']?>" /> <br />
    fav music: <input type="text" height="200px" width="300px"
        name="favmusic" value="<?php
        
    echo $value ['favmusic']?>" /> <br />
    fav books: <input type="text" height="200px" width="300px"
        name="favbooks" value="<?php
        
    echo $value ['favbooks']?>" /> <br />
    <input type="submit" value="update profile" /></form>
    <br />
    <br />
    want to change your password?
    <form action="?do=updatepw" method="post">current password: <input
        type="password" name="currentpassword" /> <br />
    new password: <input type="password" name="newpassword" /> <br />
    <input type="submit" value="update password" /></form>

    <?php
    }
    ?>

  7. #47
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Maybe that's a good idea.

    No offense taken, but I honestly don't understand why it's not working. I've done this before, the mysql_query codes are the same but this one still doesn't work.

    @Caleb: grab_username: wsg14
    Last edited by wsg14; 17-11-2008 at 10:06 PM.

  8. #48
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    do what I said above, tell me what outputs.

  9. #49
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Quote Originally Posted by Dentafrice View Post
    do what I said above, tell me what outputs.
    it's in the edit.

Page 5 of 5 FirstFirst 12345

Posting Permissions

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