I have tried to use this code to make my install file, carry out a SQL Command within a function.
Here is the code:
private function buildDB() {
$sql = <<<MySQL_QUERY
CREATE TABLE IF NOT EXISTS users (
id bigint(20),
md5_id VARCHAR(200),
created VARCHAR(100),
full_name tinytext,
user_name varchar(200),
user_email varchar(220),
user_level tinyint(4),
pwd varchar(220),
address text,
country varchar(200),
tel varchar(200),
fax varchar(200),
website text,
date date,
users_ip varchar(200),
approved int(1),
activation_code int(10),
banned int(1),
ckey varchar(220),
ctime varchar(220),
)
MySQL_QUERY;
return mysql_query($sql) or die("failed because of the following error: " . mysql_error());
}
Unfortunately its coming up with the following 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 ')' at line 22
But MySQL is on the latest version and i can not work it out at the moment, is there something i’m missing.
Line 22 of the file is:
private function buildDB() {
Any Ideas?
Pretty sure the last
,isn’t supposed to be there