and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello everyone! I have been developing a simple messageboard for the company I work at. However, there is a problem!!!! I enter the new users data and call up this script to enter it into the database:
echo "Please wait, entering user ".$username." into our database <br>";
//Connect to the server and select the correct database
$linkID = @mysql_connect()
or die(mysql_error());
if($linkID){
echo "Connected to the database..";
}
@mysql_select_db("messages") or die("Could not connect to the database");
//Insert the user data into the database if the user doesn't exist already
$query = "INSERT INTO users SET username ='$username',password='$password'";
I am pretty sure the code is correct, but after I hit 'Submit', the page takes about a minute to load and it doesn't execute anything after the first line of the code, the echo statement. I am using Apache 1.3.35, PHP 4.4.2, and MySQL 4.1.20. I have both the Apache and PHP installed and configured correctly, and MySQL is supported automatically by PHP (or so I have heard). If anyone can help me with this, I'd appreciate it very much!!!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Warning: mysql_connect(): Lost connection to MySQL server during query in c:\apache\apache\htdocs\new user.php on line 17
Fatal error: Maximum execution time of 30 seconds exceeded in c:\apache\apache\htdocs\new user.php on line 17
tags!
I have no clue as to why it looses the connection to the MySQL server.. Could it be because I haven't specified the host, username, and password in my connect statement?
Mike
No luck.. I tried putting in the connection information but it gives me the same error. Perhaps I made a mistake in setting MySQL up.. It IS supported automatically with my version of PHP/Apache, right? Or is there anything I have to do after setting it up to make it work?
You haven't gotten any fatal error meassages about calls to undefined functions, so your PHP install is supporting mysql. Have you logged in to mysql using a db management utility (like phpMyAdmin)? Have you had a look at the user permissions for the user you are connecting to the DB with?