Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 PHP Code: Create mySQL table with PHP Jump to:  
Category: >> PHP Code >> Create mySQL table with PHP Bookmark and Share

<< lastnext >>

Snippet Name: Create mySQL table with PHP

Description: Good for install scripts or automated table building.

Comment: (none)

Language: PHP, MYSQL
Highlight Mode: PHP
Last Modified: March 01st, 2009

<?PHP
 
$table_def  = "id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,";
$table_def .= "student_id INT(11) NOT NULL,";
$table_def .= "f_name TINYTEXT NOT NULL,";
$table_def .= "l_name TINYTEXT NOT NULL,";
$table_def .= "supervisor TINYTEXT NOT NULL,";
$table_def .= "building TINYTEXT NOT NULL,";
$table_def .= "email TINYTEXT NOT NULL,";
$table_def .= "score SMALLINT(6) NULL,";
$table_def .= "stamp DATETIME NOT NULL,";
$table_def .= "UNIQUE KEY id (id)";
 
IF (!@MYSQL_QUERY ("CREATE TABLE $tablename ($table_def)")) {
     ECHO "The database table, '$tablename', could not be created.";
} ELSE {
     ECHO "Successfully created the '$tablename' table.";
}
 
?>
 


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 50 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?