PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help
Even if you have a table setup, read this section to see how to connect to a database and execute an SQL query.
We will create a table that holds email information for a person.
In order to work with MySQL we have to open a connection.? The syntax is mysql_connect (mysql_host, mysql_username, mysql_password).? By specifying nothing, we connect to the local host MySQL database and open a connection as the default user.? If you want to log in as a certain user to a certain MySQL host then enter your settings.
We specify the database, by passing "test_database" as the first parameter in the mysql_db_query function call.
Now, we can interact with the database.? We will create a table so we can store individual records.? For the table email_info, we delegate two fields.? One to hold the full name (e.g. 'Kris Arndt') and another to hold the email address (e.g. '[email protected]').