how do you add the create table in the PHP script !!!!???!!!?

  • Thread starter Thread starter JMARIE
  • Start date Start date
J

JMARIE

Guest
this is the database info to make one

"CREATE TABLE omgruser_commentscript_comments(
`commentid` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`tutorialid` INT( 11 ) NOT NULL DEFAULT '0',
`name` TEXT NOT NULL ,
`url` TEXT NOT NULL ,
`comment` TEXT NOT NULL ,
`email` TEXT NOT NULL ,
`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE = MYISAM"

yet i want to insert it on the php script i have already, how do i add it in the beginning of the php script like required

<?
$db_hostname = "localhost"; $db_username = "......"; $db_pass = "......"; $db_name = ".........";
 
Do you need to create the table every time you run the php script? You can execute a database statements (what db are you using? PHP has a couple of different db interfaces that you can use - I'm mostly familiar with mysql). In mysql with php, you can create a string containing your create table statement and use that as a parameter to mysql_query($create_table_string, $db_connect) ;

Mostly though, I find I create tables using a mysql administration application and just use php to access them. I can't imagine you want to create a table every time unless your writing an installation script.
 
Back
Top