problem with query syntax?!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Blondy
Forum Commoner
Posts: 32
Joined: Thu Mar 06, 2008 5:55 pm

problem with query syntax?!

Post by Blondy »

hi guys I have this query and I un it easily through phpmyadmin
but no chance using $sql in my code

Code: Select all

$sql = "CREATE TABLE `news`(
               id INT NOT NULL AUTO_INCREMENT,
               PRIMARY KEY(id),
               subject VARCHAR(110) NOT NULL DEFAULT 'No topic.',
               news TEXT NOT NULL,
               image TEXT NOT NULL,
               iname TEXT NOT NULL,
               date VARCHAR(20) NOT NULL DEFAULT '00/00/00',
               time VARCHAR(20) NOT NULL DEFAULT '00:00 am'
               );
 
               CREATE TABLE footer(
               id INT NOT NULL AUTO_INCREMENT,
               PRIMARY KEY(id),
               title VARCHAR(100),
               subject VARCHAR(110) NOT NULL DEFAULT 'No topic.',
               what TEXT NOT NULL,
               image TEXT NOT NULL,
               iname TEXT NOT NULL,
               date VARCHAR(20) NOT NULL DEFAULT '00/00/00',
               time VARCHAR(20) NOT NULL DEFAULT '00:00 am'
               );
 
               CREATE TABLE settings(
               imgq TEXT NOT NULL,
               th TEXT NOT NULL,
               address TEXT NOT NULL,
               telephone TEXT NOT NULL,
               pcode TEXT NOT NULL,
               email TEXT NOT NULL,
               fax TEXT NOT NULL
               );
 
               CREATE TABLE schedule(
               program TEXT NOT NULL,
               programlong TEXT NOT NULL,
               day TEXT NOT NULL,
               clock TEXT NOT NULL
               );";
gives me this error
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE footer( id INT NOT NULL AUTO_IN' at line 10
if I remove the whole create table footer part it gives me the same error for the next create table sentence?
phppucci
Forum Newbie
Posts: 17
Joined: Fri Oct 03, 2008 2:27 pm

Re: problem with query syntax?!

Post by phppucci »

You can't run more than one query at a time in php.
Blondy
Forum Commoner
Posts: 32
Joined: Thu Mar 06, 2008 5:55 pm

Re: problem with query syntax?!

Post by Blondy »

so will try someway else thanks, dude
Post Reply