MySQL Forums
Forum List  »  PHP

Search problem
Posted by: Angie Stokes
Date: June 12, 2017 07:21AM

I am having a problem with some code. It was working fine and it is now not finding records in a table which are definitely there. I have done some check to make sure it is reading a variable from the page before and they it is collecting the right information to do the search on but it is not finding it.

my sql is as follows
$resultID = mysql_query("SELECT * from admin WHERE username = '$username' AND password = '$password'", $linkID)or die(mysql_error()); 
  if (mysql_num_rows($resultID)>0){ //there was a result so the user is valid
    $_SESSION['usertype'] = 'valid_user'; // set a session variable we can use elsewhere
	while ($row = mysql_fetch_assoc($resultID)) 
{ 
$userid = $row['adminID'];
$_SESSION['userid'] = $userid;
$status = $row['status'];
//get time
$timestamp = time();
 $time = strftime("%X", $timestamp);
 //add to login table

$result = mysql_query("INSERT INTO adminlogin( userID, Date, Time ) VALUES('$userid', Now(), '$time')", $linkID)or die(mysql_error()); 
}

    return true;
  }else{
     return false;
  }
}

I would br grateful if you can she any light on this.

I am on on windows 8.1. I am using apache as my client server and mysql manager as my gui interface for the tables

Thanks in anticipation of a reply

Angie

Options: ReplyQuote


Subject
Written By
Posted
Search problem
June 12, 2017 07:21AM
June 12, 2017 10:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.