Different approach?

From: Date: Thu, 17 Mar 2005 16:01:44 +0000
Subject: Different approach?
Groups: php.general 
Request: Send a blank email to php-general+get-210990@lists.php.net to get a copy of this message
Hi, I've read: > http://dev.mysql.com/doc/mysql/en/create-table.html Would anyone code/approach this differently? ################################################# $server = "localhost"; $user = "myname"; $pass = "mypass"; $db = "mydb"; $table = "demo_assignment1"; ################################################# $myconnection = mysql_connect($server,$user,$pass); ################################################# $sql = "CREATE TABLE IF NOT EXISTS demo_assignment1 ( StudentNumber varchar(8) NOT NULL default '', Exercise1 varchar(100) NOT NULL default '', Exercise2 varchar(100) NOT NULL default '', TimeStamp timestamp(14) NOT NULL, PRIMARY KEY (TimeStamp) ) TYPE=MyISAM COMMENT='place something here';"; mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); ################################################# $sql = "INSERT INTO $table (StudentNumber,Exercise1,Exercise2) values ('$StudentNumber','$Exercise1','$Exercise2')"; mysql_select_db($db,$myconnection); mysql_query($sql) or die(print mysql_error()); mysql_close($myconnection);

« previous php.general (#210990) next »