Start New Discussion within our Web Development Community
include 'vars.php';
$conn = mysql_connect($hostname,$username,$pass)Or DIE ("Unable to connect to database");
mysql_select_db($dbname, $conn);
global $name,$pass,$userid,$sex,$nam,$password,$flag;
$userid = $_REQUEST['userid'];
$password = $_REQUEST['password'];
$query = "SELECT name,password,lastlogin FROM binaryusers where userid = '$userid'";
$res = mysql_query($query)or die ("Bad query: " . mysql_error() );
if (mysql_fetch_row($rs))
global $name, $pass, $sex, $nam,$lastlogin;
$nam = mysql_result($res,0,0);
$pass = mysql_result ($res,0,1);
$lastlogin=mysql_result ($res,0,2);
if ($pass==$password&&$userid!='')
global $userid,$pass,$lastlogin;
$_SESSION['user'] = $userid;
$_SESSION['pass'] = $pass;
$query="update binaryusers set lastlogin='$jtime' where userid='$userid'";
echo "<meta http-equiv=\"REFRESH\" content=\"0;url=memberlogin.php\">";
  echo "userid or password is incorrect";
  echo "userid or password is incorrect";


No database selected error Plz help

You know it would be nice if you can discussed more about the issue rather than just showing the code?

please indent your code. Makes it easier to read.
Check the following variables and verify they are correct.
One of them must be wrong!
Post back if this works or when you get a solution.

Try Adding The Following after the first line of code

mysql_select_db("nameofdatabase") or die("Connection Error");
This article has been dead for over six months. Start a new discussion instead.