471,854 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,854 software developers and data experts.

I having problem updating User Records

Hi, everyone I've been trying to figure out a way for a user to update there information. I'm using sections to identify the specific user..Here is the form


$query=" SELECT * FROM pix WHERE username='$session->username'";

while ($i < $num) {
$phonenumber=mysql_result($result,$i,"phonenumber" );


body {
font: 81% verdana, arial, sans-serif;
background-color: #fff;
margin: 10px;
padding: 4px;
echo "<table align=LEFT width=670 height=350 bgcolor=ffffff BORDER=1 BORDERCOLOR=eaeaea cellpadding=5>";
echo "<tr>";
echo " <td bgcolor=#dddddd><img src=\"http://www.atlantasundergroundhitsecommerce.com/flash_mp3_player/store copy.jpg\" width=667 height=128 alt= border=1><br>
echo "</tr>";
echo "<tr>";
echo "<td align=center bgcolor=#dddddd><b><font color=gray size=1>Registers (Personal)Payment Information</font></b><br>
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=eaeaea><font color=gray size=1>All payments from Atlanta's UnderGround Hits to the register will be mailed to the following address. It is the responsiblity of the
register to contact Atlanta's UnderGround Hits should their address change during the distribution period. <br><font color=red>It is important this information is valid.</font>
echo "</tr>";
echo "<tr>";
echo "<td>
<form enctype=multipart/form-data action=\"update_artistinfo.php\" method=\"post\">
<font color=gray size=2>First Name :&nbsp;&nbsp;</font><input name=\"ud_firstname\" value=\"$firstname\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;<font color=gray size=2>E-Mail: <input name=\"ud_email\" value=\"$email\">
echo "</tr>";
echo "<tr>";
echo "<td><font color=gray size=2>Last Name :&nbsp;&nbsp;</font><input name=\"ud_lastname\"value=\"$lastname\">&nbsp;&nbs p;&nbsp;&nbsp;<font color=gray size=2>Phone Number :&nbsp;</font><input name=\"ud_phonenumber\" value=\"$phonenumber\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td><font color=gray size=2>Address :</font>&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"ud_address\" value=\"$address\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;<font color=gray size=2>Album Retail:&nbsp;</font><input name=\"ud_retail\" value=\"$retail\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td><font color=gray size=2>City :<font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp; <input name=\"ud_city\" value=\"$city\">
echo "</tr>";
echo "<tr>";
echo "<td><font color=gray size=2>State :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;</font><SELECT name=\"ud_state\">
<option value=\"AL\">ALABAMA</option>
echo "</tr>";
echo "<tr>";
echo "<td><font color=gray size=2>ZIP CODE:<font>&nbsp;&nbsp;<input name=\"ud_zip\" value=\"$zip\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=>
<br><br><font size=2 color=gray><b>User:</b>&nbsp;&nbsp;&nbsp;</font>
<SELECT name=\"ud_username\">
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=><hr color=eaeaea><font color=gray size=1>Once you have completed the above your will be ready to submit your information. You will then be direct to the album upload section of the Online Registartion.
Your total album upload can be no more than 50 megs. Click the below submit to proceed. </font></td>";
echo "</tr>";
echo "<td>
<input type=submit value=Submit>
echo "</tr>";
echo "</table>";
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a class=T1 href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a class=T1 href="register.php">Sign-Up!</a></td></tr>


* Just a little page footer, tells how many registered members
* there are, how many users currently logged in and viewing site,
* and how many guests viewing site. Active users are displayed,
* with link to their user information.
echo "</td></tr><tr><td align=\"center\" class=T1><br><br>";
echo "<b>Update your profile information <br>";
The form displays the current information the user has stored in the DB. Once the user makes changes this is the PHP SCRIPT that should update the database.

// check to see if the form was posted with the correct id's
if (isset($_POST['_submit']) AND isset($_REQUEST['ud_username']) ) {
$ud_username = intval($_REQUEST['ud_username']);
if ($ud_username < 0) {

# escape data and set variables
$ud_username = addslashes($_POST["ud_username"]);
$ud_firstname = addslashes($_POST["ud_firstname"]);
$ud_email = addslashes($_POST["ud_email"]);
$ud_lastname = addslashes($_POST["ud_lastname"]);
$ud_phonenumber = addslashes($_POST["ud_phonenumber"]);
$ud_address = addslashes($_POST["ud_address"]);
$ud_retail = addslashes($_POST["ud_retail"]);
$ud_city = addslashes($_POST["ud_city"]);
$ud_state = addslashes($_POST["ud_state"]);
$ud_zip = addslashes($_POST["ud_zip"]);

$usr = "xxxxxxx";
$pwd = "xxxxx";
$db = "xxxxx";
$host = "xxxx";
// connect to database server
$cid = mysql_connect($host,$usr,$pwd)
or die("Server connnect ERROR: " . mysql_error());
// select the database
or die("Database select ERROR: " . mysql_error());
$query="UPDATE pix SET firstname='$ud_firstname', email='$ud_email', lastname='$ud_lastname', phonenumber='$ud_phonenumber', address='$ud_address', retail='$ud_retail', city='$ud_city', state='$ud_state', zip='$ud_zip' WHERE username= '$ud_username'";
echo "Record Updated";

but when clicked nothing happens. The information is not being updated in the database. Could a brotha get a little help on this one!!!! It seems simply so I know I making a small mistake.

Thank You
Jan 19 '07 #1
2 1736
4,258 Expert 4TB
1. why don't you append the mysql_error() to the UPDATE statement[php]mysql_query($query) or die
"Update error: ".mysql_error();[/php] so you know it is / or not an update error

2. when the form is not submitted correctly, i.e. where is the ELSE branch of this statement[php]if (isset($_POST['_submit']) AND isset($_REQUEST['ud_username']) ) {[/php]

3. I cannot find the close brace of the IF statement nor the ELSE of that statement.

In cases 2 and 3 your script ends without action or message.

Ronald :cool:
Jan 19 '07 #2
Problemed solved..Thanks again Ronald !
Jan 20 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Jason | last post: by
1 post views Thread by Chris Jackson | last post: by
1 post views Thread by davidgordon | last post: by
5 posts views Thread by JimmyKoolPantz | last post: by
reply views Thread by NeoPa | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.