CREATE TABLE statement errors
#1

I know it's not worth the effort to create tables via PAWN, but I've only done it to get used to SQL statements. However, even though I'm using the correct syntax, I'm getting some errors.

Код:
	
	mysql_query(db, "CREATE TABLE IF NOT EXISTS `Houses` (
	`hdbID` INT(20) AUTO_INCREMENT,
	`hOwner` VARCHAR(25) NOT NULL,
	`hPrice` INT(20) NOT NULL,
	PRIMARY KEY(`hdbID`)
	) ENGINE = InnoDB DEFAULT CHARSET=latin1");
The size of the int data types are totally random.

Compiler errors:

Quote:

E:\SA-MP server\gamemodes\house.inc(56) : error 037: invalid string (possibly non-terminated string)
E:\SA-MP server\gamemodes\house.inc(57) : warning 217: loose indentation
E:\SA-MP server\gamemodes\house.inc(57) : error 029: invalid expression, assumed zero
E:\SA-MP server\gamemodes\house.inc(57) : warning 215: expression has no effect
E:\SA-MP server\gamemodes\house.inc(57) : error 001: expected token: ";", but found "`"
E:\SA-MP server\gamemodes\house.inc(57) : error 029: invalid expression, assumed zero
E:\SA-MP server\gamemodes\house.inc(57) : fatal error 107: too many error messages on one line

Thanks!
Reply
#2

You need to add backslash at the end of the line for a new line.
pawn Код:
mysql_query(db, "CREATE TABLE IF NOT EXISTS `Houses` ( \
        `hdbID` INT(20) AUTO_INCREMENT, \
        `hOwner` VARCHAR(25) NOT NULL, \
        `hPrice` INT(20) NOT NULL, \
        PRIMARY KEY(`hdbID`) \
        ) ENGINE = InnoDB DEFAULT CHARSET=latin1
    "
);
Reply
#3

It works! Thank you so much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)