Create Table in MySql using PHP

Create table in MySql using PHP:
<?php
$con = mysql_connect("localhost","root","root");
mysql_select_db("db_name", $con);
$sql = "CREATE TABLE Persons
(
FirstName varchar(15),
LastName varchar(15),
Age int
)";
// Execute query
mysql_query($sql,$con);
mysql_close($con);
?>

No comments:

Post a Comment