Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 19th, 2008, 08:13 PM
Registered User
Join Date: Aug 2008
Location: Columbus, Ohio, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Carlo Gambino
Default New to PHP


I bought "Beginning PHP, Apache, MySQL Web Development" recently to learn the fundamentals of dynamic web programming. I have come across a troubling error that I can not solve, can someone help?

Chapter 3 creates "createmovie.php" and "moviedata.php" to build and populate database "wiley". I came across the following:

//Connect to MySQL
$connect = mysql_connect("localhost", "root", "MyPaSs") or
    die ("Access Denied- www.Digital-Syndicate.org")

//create main database. 
    or die(mysql_error());

//make sure our recently created database is the active one
mysql_select_db ("wiley");

//create "movie" table
$movie = "CREATE TABLE movie (
    movie_id int(11) NOT NULL auto_increment,
    movie_name varchar(255) NOT NULL,
    movie_type tinyint(2) NOT NULL default 0,
    movie_year int(4) NOT NULL default 0,
    movie_leadactor int(11) NOT NULL default 0,
    movie_director int(11) NOT NULL default 0,
    PRIMARY KEY (movie_id),
    KEY movie_type (movie_type,movie_year)

$results = mysql_query($movietype)
    or die(mysql_error());

//create "people" table
$people = "CREATE TABLE people (
    people_id int(11) NOT NULL auto_increment,
    people_fullname varchar(255) NOT NULL,
    people_isactor tinyint(1) NOT NULL default 0,
    people_isdirector tinyint(1) NOT NULL default 0,
    PRIMARY KEY (people_id)

$results = mysql_query($people)
    or die(mysql_error());

echo "Movie Database Successfully Created!";

Which gives the error:

Parse error: syntax error, unexpected T_STRING in /var/www/createmovie.php on line 7
 I have searched and made no error that I can see. So I went a step further. I downloaded the code from this site, modified what I needed to connect, and uploaded to the server- and I got this error:
Fatal error: Call to undefined function mysql_create_db() in /var/www/createmovie2.php on line 7
I'm still not seeing what's missing. Can someone direct me to a solution here?

Reply With Quote
  #2 (permalink)  
Old August 19th, 2008, 09:12 PM
Friend of Wrox
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

It looks like the PHP system you are running on was not configured to include the MySQL functions.

One of the disadvantages of PHP is that you must rebuild it when you want to include features not built in to the version your are running. (To be fair, that *can* be one of its strengths, too. But it can be a real pain for newbies.)

You may want to try to find a version of PHP that is already configured to include all the MySQL functions.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Beg. PHP 5 > Ch. 11 - fetch_field.php crater BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 2nd, 2007 12:20 PM
PHP Warning: PHP Startup: Unable to load dynamic l surendran Beginning PHP 1 May 29th, 2006 08:49 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM
Ch. 1: PHP Installation Troubles: php3 vs php manjito BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 June 12th, 2003 03:59 PM

All times are GMT -4. The time now is 05:27 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.