Jump to content


Photo

Need some help on this login Script...


  • Please log in to reply
2 replies to this topic

#1 kee2ka4

kee2ka4
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 18 September 2006 - 05:37 PM

Hello Everyone! I have a basic knowledge in php. I have got a Login Script where user can enter in their UserID (which is a numeric value) and a Password to login.

I need a login system for my site however I need the user to enter in their email address and password. Therefore I edited the login Script changed all the variables and post values etc etc... However I keep getting the following error message::

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.com' at line 1"


Can anyone point me out in the right direction? Thanks for all the help.... ;)

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 18 September 2006 - 06:12 PM

Could you post the code you use to perform your SQL Query here, aloing with the actuall query too. Not sure why you are getting that error. If you post your code, should  be able to shed some light onto it.

#3 kee2ka4

kee2ka4
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 18 September 2006 - 06:38 PM

Hi! Thanks for your reply.. I did try to copy and paste the whole code but the page crashes... The sql query code in the login script is:
$query = "SELECT * FROM tbl_users WHERE cEmail = ".$email;
	 
	 //echo $query;
	  mysql_pconnect($_SESSION['MYSQL_SERVER1'],$_SESSION['MYSQL_LOGIN1'],$_SESSION['MYSQL_PASS1'])
                   or die("Unable to connect to SQL server");
  	  mysql_select_db($_SESSION['MYSQL_DB1']) or die("Unable to select database");
		$result = mysql_query($query) or die("Invalid query: " . mysql_error());
		
		// if userid is not present in DB go back to login page...
		if (mysql_affected_rows() != 1) { 
		echo "Error2!<br />
    Please try again!<br />"; }

Thanks for your help...





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users