Okay hey again guys. THank you so much with starting me off with php and mysql already. I've read a php tutorial and completed it overnight. Now Im moving onto mysql. I've look at the xampp forum and wanted to look if other people have the same problem I did, but the forum had a language I did not understand. As for @mysql_select_db and mysql_connect what shuold I place in as the database? the database is in my PhpMyadmin and it was created by phpMyadmin. Database is named Test. THANK YOU AGAIN GUYS!!!
I would suggest not moving onto mySQL until you get a full bearing of php. That is not possible overnight unless you have a very detailed book and you're a quick reader. Lets see, Code: mysql_connect requires 3 paraments, hostname, username, and password to username. Example: Code: mysql_connect( localhost, john, password ); This establishes a connection to your mySQL database. You will have to use (or learn the SQL) phpMyAdmin to create a username (you will find it under the 'Priviledges' tab (i think you can figure it out in a few minutes.) Next.. Code: @mysql_select_db This select which database you will be using. It uses 2 parameters (second of which is optional.) Usage would be like this: Code: $connect = mysql_connect( localhost, john, pw ); @mysql_select_db( 'testdb', $connect ); // Or @mysql_select_db( 'testdb' ); You will also notice the '@'. That is an error handler. If you do not put that, and there is an error connecting to the database, it will give you an ugly error messege, instead of letting you exit the page gracefully. Example: Code: $connect = @mysql_connect( localhost, john, pw ); if( !$connect ) { echo 'Error connecting to mysql. .'mysql_error(); } $select = @mysql_select_db( 'testdb', $connect ); if( !$select ) { echo 'Error selecting db'; return false; exit; } else { echo 'Hurray, it connected!'; } ps. the '@' isnt required.