Forum Moderators: coopster
which I understand is usually related to closing tags, quote marks, etc. However I could not find any open commands on the line before and line 18 includes ' marks to delineate the range of values available for an enum category. I have not created a table with an enum category before and am not sure if this could potentially be the problem. I have included the script below and any help would be greatly appreciated.
<?php
include 'config.php';
include 'opendb.php';
mysql_select_db('test') or die('Cannot select database');
$query = 'CREATE TABLE buyerinfo( '.
'cid INT NOT NULL AUTO_INCREMENT, '.
'cname VARCHAR(40) NOT NULL, '.
'cemail VARCHAR(40) NOT NULL, '.
'chomephone VARCHAR(40) NOT NULL, '.
'cworkphone VARCHAR(40), '.
'cotherphone VARCHAR(40), '.
'ctimetocall VARCHAR(40) NOT NULL, '.
'carea VARCHAR(40) NOT NULL, '.
'cpropertytype enum('Single Family Detached', 'Condo', 'Duplex - single unit', 'Duplex -
both units', 'Townhome', 'Mobile home', 'Multi-family 2-4 units', 'Multi-family 5 or
more') NOT NULL, '.
'cbedrooms TINYINT(4) NOT NULL, '.
'cagent enum('Yes', 'No') NOT NULL, '.
'cagreement VAR(40), '.
'crepairs VAR(40), NOT NULL, '.
'cpricerange VAR(40) NOT NULL, '.
'ccurrentpayments VAR(40) NOT NULL, '.
'cwhen enum('Today', '30 days', '3 months', 'No rush'), NOT NULL, '.
'ccredit enum('Good', 'OK', 'Bad'), NOT NULL, '.
'cownrent enum('Rent', 'Own') NOT NULL, '.
'ccomment VAR(40), '.
'PRIMARY KEY(cid))';
$result = mysql_query($query);
include 'closedb.php';
?>
query("CREATE TABLE chat(
id INT(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
login VARCHAR(20) NOT NULL DEFAULT '',
message VARCHAR(255) NOT NULL DEFAULT '',
itstime VARCHAR(10) NOT NULL DEFAULT '')");
I thought this might be because I had opened a parenthesis, without closing it. When I added a closed parenthesis at the end of the variable
((replacing 'PRIMARY KEY(cid))';
with 'PRIMARY KEY(cid))');
it gave me this error
Fatal error: Function name must be a string in /home/cornerst/public_html/maketestdb.php on line 9
I am using MySQL also.