Mysql Select
- Mister-Mind
-
Mister-Mind
- Member since: Jul. 1, 2006
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
Does anyone know the MYSQL code To Select a database. Not the PHP code but the Syntax please.
- SpamBurgeralt
-
SpamBurgeralt
- Member since: Jul. 22, 2005
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
I'm 12 years old and what is this?
- Ross
-
Ross
- Member since: Dec. 15, 1999
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate
Ross Snyder - PHP Juggler
If you find a problem on the website, send me a PM.
- JeremysFilms
-
JeremysFilms
- Member since: Feb. 18, 2005
- Offline.
-
- Forum Stats
- Member
- Level 18
- Blank Slate
Before selecting a database, make sure you are connected to MySQL. The following lines show how to connect to MySQL and how to select a database:
@mysql_connect('localhost','usernameToData
base','password') OR die('Could not connect to MySQL.');
@mysql_select_db('databaseName') OR die('Could not connect to database.');
*NOTE: the @ preceeding the mysql functions are used to suppress any errors that would be returned. Using "or" after these functions instructs execution of the next command if the first execution returns false. In this case, and better understood, if the mysql function fails, it's error will be suppressed and a die function will execute in order to output a more "user-friendly" error message.
Also, you need to actually feed queries to PHP to carry out tasks to the database.

