Saturday, February 8, 2014

Php program to create a table in the database

<?php

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
else
 {
   echo "ok data base";
  }
mysql_select_db("emp", $con);

$sql = "CREATE TABLE Per
(
FirstName varchar(15),
LastName varchar(15),
Age int
)";
echo "table create";
// Execute query
mysql_query($sql,$con);
mysql_close($con);

?>





 OUTPUT:


No comments:

Post a Comment