gc40 Posted August 27, 2007 Share Posted August 27, 2007 I am trying to figure out why my script isn't updating the information of the user names stored in the database. Can anyone give me the solution? Below is the script: <link href="images/style.css" rel="stylesheet" type="text/css"> <?php if(session_id() == ""){ session_start(); } Authenticate(); UserStatus(); include("../class/config.php"); $self=$_SERVER['PHP_SELF']; /* If form hasn’t been submitted */ if(!isset($_POST['submit'])) { ?> <h2>Change A User's Password</h2> <div id="admin-form"> <form method="post" action="admin_user_index.php?action=edituser"> <p><label for="username">Username: </label> <select name="user" id="username"> <? include("../class/config.php"); $sqlcats="Select * from news_saxon_saxon_users"; $rescats=mysql_query($sqlcats,$db); while($onecats=mysql_fetch_object($rescats)){ echo "<option value=$onecats->USER_ID"; if($onecats->USER_ID==$onecat->USER_NAME) echo " SELECTED " ; echo ">$onecats->USER_NAME</option>"; } ?> </select></p> <p><label for="Password1">New Password: </label><input type="password" name="user_pwd1" id="Password1" /></p> <p><label for="Password2">Re-enter Password: </label><input type="password" name="user_pwd2" id="Password2" /></p> <p><input type="submit" class="submit button" name="submit" value="Submit" /> <input type="reset" class="button" name="reset" value="Reset" /></p> </form> </div> <?php } // If form has been submitted else { $user=$_POST['user']; $user_pwd1=$_POST['user_pwd1']; $user_pwd2=$_POST['user_pwd2']; if($user_pwd1=="" && $user_pwd2=="") { ?> <h2>Change A User's Password</h2> <div id="pwd-form"> <p class="error">Please enter a new password.</p> </div> <?php echo "</td></tr></table>"; include('footer.php'); exit; } if($user_pwd1<>$user_pwd2) { ?> <h2>Change A User's Password</h2> <div id="pwd-form"> <p class="error">Your passwords don't match! Please try again.</p> <p><a href="admin_user_index.php?action=edituser">Previous page</a></p> </div> <?php echo "</td></tr></table>"; include('footer.php'); exit; } $error = DBConnect ($mhost,$muser,$mpass,$mdb); if (trim($error) != "") { echo "<p class=\"error\">User information not available at this time! Please contact the site administrator.</p>"; echo $error; echo "</td></tr></table>"; include('footer.php'); exit; } // does this user exist? $error=CheckUsername($user,$prefix); if (trim($error) != "") { echo "<p>Search completed for user ".$user."</p>\n"; echo $error; echo "</td></tr></table>"; include('footer.php'); exit; } // get all user info list($member_user_id,$member_full_name,$member_user_pwd,$member_user_status)=GetUser($user,$prefix); $new_pwd=md5($user_pwd1); $error = DBConnect ($mhost,$muser,$mpass,$mdb); if (trim($error) != "") { echo "<p class=\"warning\">Password not updated.</p>"; echo $error; echo "Please contact the site administrator.</p>\n"; echo "</td></tr></table>"; include('footer.php'); exit; } $tblname = QuoteSmart($prefix."saxon_users"); $new_pwd = QuoteSmart($new_pwd); $member_user_id = QuoteSmart($member_user_id); $update= "UPDATE LOW_PRIORITY IGNORE $tblname SET USER_PWD='$new_pwd' WHERE USER_ID='$member_user_id'"; if (mysql_query($update)) { echo "<p class=\"success\">Password for ".$user." updated</p>"; echo "</td></tr></table>"; include('footer.php'); exit; } echo "<p class=\"error\">Error! Password not updated</p>"; echo "Please contact the site administrator.</p>\n"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/66859-user-info-not-posting-to-database/ Share on other sites More sharing options...
pl_harish Posted August 27, 2007 Share Posted August 27, 2007 try this. $userVal = $onecats->USER_ID; echo "<option value=$userVal"; if that doesn't work, it simply means there is no value in $onecats->USER_ID.. debug that. regards, Harish www.harishpalaniappan.com www.floresense.com Quote Link to comment https://forums.phpfreaks.com/topic/66859-user-info-not-posting-to-database/#findComment-335157 Share on other sites More sharing options...
gc40 Posted August 27, 2007 Author Share Posted August 27, 2007 I am lost! Can you type it out exactly as it would be pasted in the code... and where should I place it? Quote Link to comment https://forums.phpfreaks.com/topic/66859-user-info-not-posting-to-database/#findComment-335183 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.