bilis_money Posted August 8, 2006 Share Posted August 8, 2006 hi,i have problem querying the record pointer.only the first record my query can see and the recordafter the first can't be seen by my query why?please help?ok this are the codes below;[code]<?phpsession_start();require_once ("opendb.php");require_once ("error_messages.php");$COerr_msgs = new error_messages; //instantiate object//get all username & password variables and assign to variables. $user = $_POST['username']; $pass = $_POST['password']; //check for empty fields if($user == ''){ $COerr_msgs->err_msgs('register1'); exit(); } else if($pass == ''){ $COerr_msgs->err_msgs('register1'); exit(); }//get old username and email address. $query = "SELECT * FROM users"; //get from database $result = mysql_query($query); $chk_dup = mysql_fetch_array($result);//assigning old data $user_old = $chk_dup[username]; $pass_old = $chk_dup[password]; //check username existence if($user_old == $user) { //encrypt new password $encrypted_pass = sha1($pass); //compare new and old password if($encrypted_pass == $pass_old) { //if password match redirect to authorized user page. echo "----> You are now registered!"; include "authorize_page.php"; //if password fail. } else { $COerr_msgs->err_msgs('activate3'); } } else { //if not exist show error message $COerr_msgs->err_msgs('activate2'); exit(); }#mysql_query("UPDATE `table` SET `field`='0' WHERE `id`='$id'") or die(mysql_error());#$query = "INSERT INTO users (first_name, last_name, username, password, email_address, signup_date, activated) #VALUES ('$fname', '$lname', '$user', '$password', '$email', 1)";#mysql_query($query) or die('Error, insert query failed');?>[/code]thanks in advance. Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 $query = "SELECT * FROM users WHERE `field` = '" . $user . "'";replace field with what the user names are stored in and try it...$chk_dup = mysql_fetch_array($result); is gonna return an array with all rows in users... if query is justSELECT * FROM users Quote Link to comment Share on other sites More sharing options...
bilis_money Posted August 8, 2006 Author Share Posted August 8, 2006 many thanks! Quote Link to comment 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.