PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i just revisiteed some old code i had, and apparently forgotten alot of php. anyhow, i have a warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) error and a Warning: mysql_query() [function.mysql-query]: A link to the server could not be established error. i am using xampp and include a config file,
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM user WHERE username = '$usercheck'")
or die();
$check2 = mysql_num_rows($check);
That error message suggests you are trying to connect as a user named ODBC. Is that the case. Also, did you change the users password? What version of mysql are you running?
Then you should be able to add/edit users in phpMyAdmin. Or at the very least, use the phpMyAdmin credentials to get into the database that you are wanting to connect to.
Sorry, I don't think I came across correctly. The database users, you should be able to edit those so that your script can actually connect to the app. phpMyAdmin is a PHP application that is connecting to MySQL. The same way it does it your app can do it, as long as you use the same credentials. Or you can actually go into the database users admin piece and change the password for the user you are attempting to connect with and try that.
zyklon wrote:Access denied for user 'ODBC'@'localhost' (using password: NO)
When there is no mysql connection mysql_query tries to establish a default connection. 'ODBC'@'localhost' strongly indicates this default connection.
Replace <? by <?php
mysql_connect returns a link resource, store it and use it is subsequent calls
Have a read of http://en.wikipedia.org/wiki/SQL_injection and use mysql_real_escape_string