Ok, I am having a problem with authenticating to MySql server in this manner. What I was trying to do was contact the MySql "rights" tables to check and make sure the current user is part of the MySql database system. When I run the following code I am always receiving back a rowcount of zero indicating the username and password I entered does not exit, but it in fact does. In real life my username and passwords are variables. If anyone could help me to know what I am doing wrong or if there is a better way I would appreciate it.
mysql_select_db('mysql', $link) or die ('Cant connect to DB mysql : ' . mysql_error());
$query = "SELECT * FROM user WHERE user = 'my_username' AND password = 'my_password'";
$result = mysql_query($query, $link) or die(mysql_error());
$rowcount = mysql_num_rows($result);
dbudde wrote:Ok, I am having a problem with authenticating to MySql server in this manner. What I was trying to do was contact the MySql "rights" tables...
Ok, I will try to clarify. The USER table in MYSQL db is part of all the tables that sets permissions for users of the MYSQL db. So, what I need is some way to check that the person attempting to log into the website I am working on actually exists in the user table. So, I need either some alternate manner of authentication to the MYSQL db or I need to get what I am attemting to do working using variables for the 'username' and 'password' where the example I gave simply shows hard coded username and password.
I am trying to see if the user exists in the MySql permissions tables to see if they are infact an authorized user of if they are not an authorized user in the way you said that.
I am not registering the users, I am trying to find out if they are already a valid user in the MySql before allowing them to continue into the website.
Boy sorry about the bad grammar, I was in a hurry. Anyway, I am just trying to make sure that anyone logging into my site are also valid users of the MySql database before allowing them to proceed into the site.
You know it does not give me an error, but you got me thinking because I think you are right about root usually only having access. I did give the user that I am trying with SELECT rights I think, I will have to look at that one. I will also try logging on as ROOT and see if that fixes my problem. Thanks for getting me thinking and I will get back with what I find ASAP.