1. Computing

PHP MySQL Tutorial

By , About.com Guide

5 of 5

Insert Into Tables
We can use the same method of using SQL commands to populate our database as we did to create it. Here is an example:

 <?php 
 // Connects to your Database 
 mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name") or die(mysql_error()); 
 mysql_query("INSERT INTO tablename VALUES ( 'Bill', 29, 'Ford' ), ( 'Mike', 16, 'Beetle' ), ( 'Alisa', 36, 'Van' )"); 

Print "Your table has been populated"; ?>

Related Video
Basic PHP Syntax
Using PHP With HTML
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. PHP with MySQL
  5. PHP MySQL - PHP MySQL Tutorial - Insert Into

©2013 About.com. All rights reserved.