Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2008, 08:13 PM
Registered User
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Carlo Gambino
Default New to PHP

Hello,

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:

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

//create main database. 
mysql_create_db("wiley")
    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)
) TYPE=MyISAM AUTO_INCREMENT=4 ";

$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)
) TYPE=MyISAM AUTO_INCREMENT=7";

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

echo "Movie Database Successfully Created!";

?>
Which gives the error:

Code:
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:
Code:
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?

 
Old August 19th, 2008, 09:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

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.





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





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