parse error in php code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

carlo2837
New php-forum User
New php-forum User
Posts: 7
Joined: Fri Jan 25, 2013 2:40 am

parse error in php code

Postby carlo2837 » Mon May 06, 2013 4:33 am

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.

User avatar
Strider64
New php-forum User
New php-forum User
Posts: 70
Joined: Sat Mar 23, 2013 8:24 am

Re: parse error in php code

Postby Strider64 » Mon May 06, 2013 6:45 am

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.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron