Page 1 of 1

parse error in php code

Posted: Mon May 06, 2013 4:33 am
by carlo2837
Hi hope somebody can help me on this.I am doing an HTML.net tutorial lesson 18 create database and tables, and I keep getting this error:
Parse error: syntax error, unexpected 'TABLE' (T_STRING) in C:\inetpub\wwwroot\phpconnect.php on line 6
I have tried everything to fix it but I cannot figure it out.I am running Php version 5.4, maybe this is the problem, maybe the code is obsolete though it seems up to date to me.
This is my code:

<?php
mysql_connect("localhost", "root", "LaTorre1937##") or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());

CREATE TABLE people (
id INT NOT NULL AUTO_INCREMENT,
FirstName CHAR,
LastName CHAR,
Phone INT,
BirthDate DATE,
PRIMARY KEY(id)
);

?>

Thank you very much I appreciate your help.

Re: parse error in php code

Posted: Mon May 06, 2013 6:45 am
by Strider64
No offense, but that website is whacked in using those tutorials on php with mysql. They are also using mysql which is depreciated, use either mysqli or PDO. In my opinion you are wasting your time learning php from that website, but that's just my opinion.