May 21, 200818 yr Hi guys, Can anybody tell me what I am doing wrong here, or maybe suggest an easier way to do it...? Below are some different coding formats i have already tried. Number 1 $query2 = "CREATE TABLE '$course_id'( '. 'id INT NOT NULL AUTO_INCREMENT, '. 'title VARCHAR(40) NOT NULL, '. 'department VARCHAR(40) NOT NULL, '. 'tutor VARCHAR(40) NOT NULL, '. 'students VARCHAR(500) NOT NULL, '. 'PRIMARY KEY(id))"; Number 2 $query2 = 'CREATE TABLE' . $course_id . '( '. 'id INT NOT NULL AUTO_INCREMENT, '. 'title VARCHAR(40) NOT NULL, '. 'department VARCHAR(40) NOT NULL, '. 'tutor VARCHAR(40) NOT NULL, '. 'students VARCHAR(500) NOT NULL, '. 'PRIMARY KEY(id))'; Number 3 $query2 = "CREATE TABLE $course_id '( '. 'id INT NOT NULL AUTO_INCREMENT, '. 'title VARCHAR(40) NOT NULL, '. 'department VARCHAR(40) NOT NULL, '. 'tutor VARCHAR(40) NOT NULL, '. 'students VARCHAR(500) NOT NULL, '. 'PRIMARY KEY(id))"; At the end of EVERY try of this is the following statement: $result2 = mysql_query($query2); I am also running another query with some of the same fields but that shouldn't matter right? I have run 2 queries before. Any ideas? Thanks in advance.
May 21, 200818 yr Author Solved it, nevermind. $sql = "CREATE TABLE `matthusele5`.`$name` (`id` INT NOT NULL, `title` TEXT NOT NULL, `department` TEXT NOT NULL, `tutor` TEXT NOT NULL, `students` TEXT NOT NULL, PRIMARY KEY (`id`)) ENGINE = MyISAM"; This seemed to work, gotta love PHP MyAdmin
Create an account or sign in to comment