Re: Access Denied

From: Date: Wed, 29 Jul 2009 01:50:27 +0000
Subject: Re: Access Denied
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-295991@lists.php.net to get a copy of this message
Ernie Kemp wrote:
Line in Program: //connect to server and select database //connect to server and select database $mysqli = mysqli_connect("localhost", "jdoe", "doepass", "testdb"); //create and issue the query $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')"; $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli)); Record in mySQl database:
Users        PASSWORD
id f_name l_name email username password <http://localhost/phpmyadmin/tbl_change.php?db=testDB&table=auth_users&prima ry_key=+%60auth_users%60.%60id%60+%3D+1&sql_query=SELECT+%2A+FROM+%60auth_us ers%60&goto=sql.php&token=2e38a21d8832de9283320672387b55c7> Edit <http://localhost/phpmyadmin/sql.php?db=testDB&table=auth_users&sql_query=DE LETE+FROM+%60testDB%60.%60auth_users%60+WHERE+%60auth_users%60.%60id%60+%3D+ 1+LIMIT+1&zero_rows=The+row+has+been+deleted&goto=sql.php%3Fdb%3DtestDB%26ta ble%3Dauth_users%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560auth_users%2560% 26zero_rows%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure.php%26 token%3D2e38a21d8832de9283320672387b55c7&token=2e38a21d8832de9283320672387b5
5c7> Delete1 John Doe john@doe.com             jdoe
*0AAD744979343D58A7F17A50E514E6AD6533D04B Message from Firefox Browser: Warning: mysqli_connect() [function.mysqli-connect <http://localhost/AllInOne/25/function.mysqli-connect> ]: (28000/1045): Access denied for user 'jdoe'@'localhost' (using password: YES) in C:\wamp\www\rogers\userlogin.php on line 9
Ok, not to be harsh, but I thought I would point it out before others jumped on this one. The answer to your question is in the question itself. Access denied for user 'jdoe'@'localhost' (using password: YES) in C:\wamp\www\rogers\userlogin.php on line 9 So, since line 9 is your mysqli_connect() call, I would suggest looking at the manual page for that. http://php.net/mysqli_connect Plus look at mysql documentation on how to create a new user, grant them privileges, and flush the privileges table. http://dev.mysql.com/doc/refman/5.1/en/adding-users.html A simple Google search would have brought you to these pages. As for the reset of the errors. Fix the first one and the others might be fixed also. Jim
Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in C:\wamp\www\rogers\userlogin.php on line 13 Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:\wamp\www\rogers\userlogin.php on line 13 This one has got me. Please Help. ..../Ernie
-- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#295991) next »