possible duplicate:
can me figure out meaning of php error message?
here code:
$con = mysql_connect("localhost", "root", ''); if (!$con) { die('cannot make connection'); } mysql_select_db('yumbox_table', $con) or die('cannot make connection'); $user_name = mysql_real_escape_string($_post['user_name']); $password = mysql_real_escape_string($_post['password']); $user_type = mysql_real_escape_string($_post['user_type']); $data = mysql_query("select * users user_name == '$user_name' , password == '$password' user_type == '$user_type'") or die(mysql_error()); $info = mysql_fetch_array($data); $count = mysql_numrows($data); if ($count==1) { echo ("success!!"); } else { echo ("big friggin failure!!"); } mysql_close($con);
and these error messages generated said code:
notice: undefined index: user_name in c:\wamp\www\login.php on line 12 call stack # time memory function location 1 0.0013 371904 {main}( ) ..\login.php:0 ( ! ) notice: undefined index: password in c:\wamp\www\login.php on line 13 call stack # time memory function location 1 0.0013 371904 {main}( ) ..\login.php:0 ( ! ) notice: undefined index: user_type in c:\wamp\www\login.php on line 14 call stack # time memory function location 1 0.0013 371904 {main}( ) ..\login.php:0 have error in sql syntax; check manual corresponds mysql server version right syntax use near '== '' , password == '' user_type == ''' @ line 1
- some of variables not set. empty. therefore
undefined index
messages - your query wring also. comparison operator strings
=
, not==
. shouldselect * users user_name = '$user_name' , password = '$password' , user_type == '$user_type'"
- you forgot
=
beforeuser_type
column.
Comments
Post a Comment