login

0 athuman said · February 11, 2015
In my project when i login it give me an error like
-Notice   undefined index :loginid
-warning Mysql-query() experts parameter 1 to be sting

Post a Reply

Replies

Oldest  Newest  Rating
0 sahith vibudhi · February 20, 2015
it would be easy to identify the error if you post the code. here my code try it.

if(isset($_POST['username'])&&isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
if(!empty($username)&&!empty($password)){

$query = "SELECT id FROM members WHERE username='$username' AND password='$password'";
if($query_run = mysql_query($query)){

$query_num_rows = mysql_num_rows($query_run);
if($query_num_rows==0){
echo 'Invalid username or password!';
}else if($query_num_rows==1){
$user_id = mysql_result($query_run,0,'id');
$_SESSION['user_id']=$user_id;
header('Location: index.php');
}
}
}
else{
echo 'please enter username and password';
}
}
0 athuman said · February 22, 2015
Thanks mutch it work ,.God bless
mr vibudhi
  • 1

PHP

107,321 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators