Jump to content

Recommended Posts

i have to udate the details of the user. i want that the form should show all the values which are already there in the database n then if the user wants to change any of it he can change otherwise the valuses should remain same as they were before but its not showing in the fields how do i do that so that it may show them...

my code is:

$userselect="SELECT*from b_users where username='$user'";
$userselect2=mysql_query($userselect);
$userselect3=mysql_fetch_array($userselect2);
$x1=$userselect3['email'];
print "Your email:<input type='text' name='email' size='15' value='$x1'><p>";

is there some problem with this?? plz help me!!
Link to comment
https://forums.phpfreaks.com/topic/14692-form-updation-using-php-n-mysql/
Share on other sites

[code]
<?php
$query = "SELECT email FROM b_users WHERE username='$user'";
$result = mysql_query($query);
if (mysql_num_rows($result) == 1) {
    $row = mysql_fetch_array($result, MYSQL_NUM);
    $email = $row[0];
    echo '<b>Your Email:</b> <input type="text" name="email" size="15" value="'.$email.'"><p>';
}
else {
    echo 'You do not have an email address saved in our database.';
}
?>[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.