PHP & mySQL Newcomer

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
barry.tighe
Forum Newbie
Posts: 2
Joined: Thu Aug 18, 2005 9:05 am
Location: Middlesbrough, UK

PHP & mySQL Newcomer

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
User avatar
barry.tighe
Forum Newbie
Posts: 2
Joined: Thu Aug 18, 2005 9:05 am
Location: Middlesbrough, UK

Post 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
Post Reply