Create mysql table using php

Submitted by:David Villa

Date added:16 March, 2014

Category:PHP

How to create mysql table using php. The php script as follows as:

Tags: create table , mysql table

Code Snippet:

<?php
mysql_connect('localhost','root','');
mysql_select_db('new');
$query=mysql_query("create table table1(id int(5),name varchar(40),img varchar(30))") or die(mysql_error());
if($query)
{
echo 'Table is created';
}
else
{
echo'Table is not created';
}
?>
 
 

Comments