Jump to content


Photo

mysql queries


  • Please log in to reply
1 reply to this topic

#1 Carl-Cox-

Carl-Cox-
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 June 2003 - 09:58 PM

ok i got this code so far i thought it was right but i keep getting the error cant do it. but the line seems ok. all the tables and rows are correct im baffled.

$mode = $HTTP_GET_VARS[\'mode\'];	if ($mode == "login"){  $username = $HTTP_POST_VARS[\'username\'];  $password = $HTTP_POST_VARS[\'password\'];  $db=mysql_connect("localhost","","") or die ("cant connect");   mysql_select_db("News",$db) or die ("cant change");  $result=mysql_query("select * from users where name=\'$username\'",$db) or die ("cant do it");  	while ($row=mysql_fetch_array($result)) {    if ($row["password"]==$password) {    	print("Successfully Logged In!<a href="default.php?"\'>Click Here</a>");    	exit;    }  	}	}

Dont you Forget It :)
[br]my first php site http://jub.jkub.com

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 04 July 2003 - 08:40 AM

Try this

$mode = $HTTP_GET_VARS[\'mode\'];    if ($mode == "login"){       $username = $HTTP_POST_VARS[\'username\'];       $password = $HTTP_POST_VARS[\'password\'];       $db=mysql_connect("localhost","","") or die ("cant connect");       mysql_select_db("News",$db) or die ("cant change");       $result=mysql_query("select * from users where name=\'$username\' and password=\'$password\'",$db) or die ("cant do it");      $numrows = mysql_num_rows($result);    	if ( $numrows > \'0\')  {  print("Successfully Logged In!<a href="default.php?"\'>Click Here</a>");                 exit; 	}   }

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users