Jump to content


This topic is now archived and is closed to further replies.


Resetting the record pointer to go back to the first record, how?

Recommended Posts


i have problem querying the record pointer.
only the first record my query can see and the record
after the first can't be seen by my query why?

please help?

ok this are the codes below;
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 == ''){
} else if($pass == ''){

//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 {
} else {
//if not exist show error message

#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');

thanks in advance.

Share this post

Link to post
Share on other sites
$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 just

Share this post

Link to post
Share on other sites


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.