<?php
$db = "1book";
$table = "_info";

$link = mysql_connect("localhost","root","pass") or die("Couldn't connect to MySQL");

mysql_query("CREATE DATABASE $db");

mysql_select_db($db , $link) or die("Select DB Error: ".mysql_error());

mysql_query("

CREATE TABLE $table (
	id INT NOT NULL AUTO_INCREMENT,
	PRIMARY KEY(id),
	name VARCHAR(30),
	home VARCHAR(30),
	mobile VARCHAR(30),
	email VARCHAR(30),
	address VARCHAR(200))

") or die("Create table Error");

mysql_close($link);
?>
Published in: MySQL
Download

Related snippets