Same ol', same ol... problem. With connecting!
Hello! So here it is:
I have a project which requires me to connect and select my database. Am I able to connect? Yes. Am I able to select my database? Of course not! Why?? I keep getting the following error:
Notice: Undefined variable: test in C:\wamp\www\css\connect.php on line 10
fail: No database selected
Line 10 of my code would be:
$sql = mysql_select_db("$test"
;
apache error log:
[Sat Dec 12 22:57:22 2009] [error] [client 127.0.0.1] PHP Notice: Undefined variable: test in C:\\wamp\\www\\css\\connect.php on line 10
[Sat Dec 12 22:57:22 2009] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
Yes, I did create a database under the name of test. This is just a test code I created in order to pinpoint the problem. On my other project, where I have a form which (is supposed to) insert the data into the database, the whole thing crashes whenever I press submit. I get that silly windows error stating that the apache HTTP server encountered a problem.
The apache server log:
[Sat Dec 12 22:54:14 2009] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Sat Dec 12 22:54:21 2009] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sat Dec 12 22:54:21 2009] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sat Dec 12 22:54:21 2009] [notice] Server built: Dec 10 2008 00:10:06
[Sat Dec 12 22:54:21 2009] [notice] Parent: Created child process 5356
[Sat Dec 12 22:54:21 2009] [notice] Child 5356: Child process is running
[Sat Dec 12 22:54:21 2009] [notice] Child 5356: Acquired the start mutex.
[Sat Dec 12 22:54:21 2009] [notice] Child 5356: Starting 64 worker threads.
[Sat Dec 12 22:54:21 2009] [notice] Child 5356: Starting thread to listen on port 80.
[Sat Dec 12 22:54:25 2009] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Sat Dec 12 22:54:26 2009] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sat Dec 12 22:54:26 2009] [notice] Server built: Dec 10 2008 00:10:06
[Sat Dec 12 22:54:26 2009] [notice] Parent: Created child process 4404
[Sat Dec 12 22:54:26 2009] [notice] Child 4404: Child process is running
[Sat Dec 12 22:54:26 2009] [notice] Child 4404: Acquired the start mutex.
[Sat Dec 12 22:54:26 2009] [notice] Child 4404: Starting 64 worker threads.
[Sat Dec 12 22:54:26 2009] [notice] Child 4404: Starting thread to listen on port 80.
So there it is, my flaws bare to the world! What am I doing wrong? Why won't this work! I get error messages even after I upload it onto the server, at least it doesn't crash?
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'chezlien'@'server404.webhostingpad.com' (using password: YES) in /home/chezlien/public_html/insert_ac.php on line 10
You suck, check your info
"You such, check your info" Yes I was getting a bit loopy in the head at that point. Any help?