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?