Insert Data code using php




PHP & MySQL Code:

<?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!";

?>

Display:

Data Inserted!

'mysql_query("insert into example'
Again we are utilizing the mysql_query work. "Embed INTO" implies that information will be put into a table. The name of the table we determined to embed information into was "illustration"

'(name, age) values('timmy mellowman', '23' ) ")'
"(name, age)" are the two segments we need to include information into. "Qualities" implies that what takes after is the information to be put into the sections that we simply determined. Here we enter the name Timmy Mellowman for "name", and 23 for "age".


Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment