Home >Backend Development >PHP Tutorial >Create data table code in php_PHP tutorial
Create data table code in php tutorial
$link=mysql tutorial_connect("localhost","root","3435945")or die("***".mysql_error());
echo "Successfully connected to the server";
if(mysql_select_db(base2,$link)) echo "Select to base2 database tutorial";
$sql="create table t1(id int(5) not null primary key,name varchar(12) not null)";
if(mysql_query($sql,$link))
echo "Table T1 created successfully";
echo "";
echo "The tables on the current base2 database are:";
echo "";
$table_list=mysql_query("show tables",$link);
while($row=mysql_fetch_row($table_list)){
echo $row[0];
echo "";
}