php - How to retrieve 'id' column from entering other fields -
here code:
<?php if(isset($submit)){ require 'db/connect.php'; $sql = "select id users username='$username' , password='$password'"; $entered_user = mysql_query($sql); $num_rows = mysql_num_rows($entered_user); $errors = array(); if( $num_rows != 1 ) { $errors[] = '-account not exist '; } elseif( $num_rows == 1 ) { while($row = mysql_fetch_array($entered_user)){ $id = $row['id']; } $errors[] = 'id number --> '.$id; } } ?>
my question: how can store id number of particular account variable? cannot produce id number , output receive when entering existing account 'id number -->' without following id.
db column names: id, username, password.
$username, $password , $submit post variables.
either change name of column in query:
$sql = "select id id users username='$username' , password='$password'";
or when try fetch it:
$id = $row['id'];
also please don't store passwords plaintext. read on how handle passwords in php.
Comments
Post a Comment