$dbhost="localhost";
$dbuser="root";
$dbpass="";
$dbname="myrecorddb";
mysql_connect($dbhost,$dbuser,$dbpass)or die(mysql_error());
mysql_select_db($dbname)or die(mysql_error());
// Creating a TABLE named STUDENT :-by Narendra Sharma
mysql_query("CREATE TABLE student(id INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(id),Name VARCHAR(30),role VARCHAR(30)")or die(mysql_error());
echo "the table has been created !! |Hurray !!! ";
//now i am insert new data to the above created table.
mysql_query("INSERT INTO student(id,Name,role) VALUES(1,Narendra,Administrator)") or die(mysql_error());
echo "The Data has been Successfully Added to the Mentioned TABLE<br>";
echo "The added content is as follow in the mentioned TABLE student";
$result=mysql_query("SELECT * FROM student")or die(mysql_error());
while($row=mysql_fetch_array($result))
{
echo "Id is - ".$row['id'] ;
echo "<br>";
echo "Name is - ".$row['Name'];
echo "<br>";
echo "The role is -".$row['role'];
echo "<br>";
}
// This program first Creates a TABLE then Insert Data ..and finally show the added elements of CREATED TABLE
?>