Page 1 of 1

PHP & mySQL Newcomer

Posted: Thu Aug 18, 2005 9:25 am
by barry.tighe
I'm a first timer for using PHP and mySQL together, I'm having some problems logging into a mySQL database from a form on a web page..any tips or help would be amazing :)

The code I'm using is ...

$connection=mySQL_connect("IP Address of computer with mySQL on", "admin", "admin password");
mySQL_select_db(intusrs, $connection);
$user=$_POST[usrnme];
$passwd=$_POST[passwd];
$query="Select * from logins where username=$user and psswd=$passwd";
$result=mySQL_query($query, $connection);
if (mySQL_num_rows($result)) {
print ("IN");
} else {
print ("FAILED");
exit;
}

The service that starts up with Windows is called mySQL41..do I need to name the service in the script?
When I submit the form, it just hangs, it used to give parse errors, but I've fixed that..

intusrs is the name of the database, it's not relational or anything like that just flat file, and logins is the table where the data is stored. I can pull out the information I require from the mySQL command line, but I can't get it to work when I pass over the login details through PHP.

Posted: Thu Aug 18, 2005 9:27 am
by feyd
MySQL may be configured to not allow "remote" connections.. If MySQL is running on the same machine as php, try "localhost" for the address..

Posted: Thu Aug 18, 2005 9:37 am
by barry.tighe
I'm guessing that I'd need to modify one of the mySQL ini files, i know that this seems like a bit of a daft question, but which one :S