When data is placed in a MySQL table is called insert data. When inserting data, it is important to remember the exact name and type of the column of the table. If you try to build a 500 word composition into a column that accepts only the size of an integer 3, you will end up with a nasty bug!
Insert data into your table
Now that you have created your form, let's put some data on the puppy! This is the Php/mysql code inserted in the data for "example" we created the table in the past lesson.
<?php
Make a MySQL Connection
mysql_connect ("localhost", "admin", "1admin") or Die (Mysql_error ());
mysql_select_db ("test") or Die (Mysql_error ());
Insert a row of information into the table "example"
mysql_query ("INSERT into example
(name, age) VALUES (' Timmy mellowman ', ' 23 ') ")
Or Die (Mysql_error ());
mysql_query ("INSERT into example
(name, age) VALUES (' Sandy Smith ', ' 21 ') ")
Or Die (Mysql_error ());
mysql_query ("INSERT into example
(name, age) VALUES (' Bobby Wallace ', ' 15 ') ")
Or Die (Mysql_error ());
echo "Data inserted!";
?>
Displayed as
Data inserted