More PHP help (20 characters)?
Hey, every time I try this code it gives me problems. I'm using a Site Point book, so it's done by an expert. At first I copied it myself and after that I copied it and pasted it right out of the e-book (PDF).
Here's the code:
<?php
mysql_query(query[, connection_id])
$sql = 'CREATE TABLE joke (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
joketext TEXT,
jokedate DATE NOT NULL
)';
if (@mysql_query($sql)) {
echo '<p>joke table successfully created!</p>';
}
else {
exit ('<p>Error creating joke table: '.
mysql_error() .'</p>');
}
?>
It gives me the following message when I refresh the page:
Parse error: syntax error, unexpected '[' in /home/content/s/h/a/shadeaux/html/phpsite/mysqlcon.php on line 33.
I'm at a loss here, could someone please help?
Thank you Joe, only problem is it created a whole new error..
Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/s/h/a/shadeaux/html/phpsite/mysqlcon.php on line 21
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/s/h/a/shadeaux/html/phpsite/mysqlcon.php on line 21
Error creating joke table: Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)
Tiger238 you did it!!!! Thank you man!!!! Thank you all for the help.