Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2005, 10:38 AM
Registered User
 
Join Date: Feb 2005
Location: Bangkok, , Thailand.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot Create "Wiley" Database - Chapter 3

Hi all,

Firstly, let me say a huge thank you for both an incredibly useful book which is supported by this wonderful forum! This forum has saved my sanity more than once already....

After many tries, I was able to install Apache 2.0.39 and Php 4.2.2 on my Windows XP Professional machine. I am running MySQL Server 4.1 and all appears to be running ok.

I do apologise in advance if my question strikes anyone as "simple" but I am stuck at the section where Createmovie.php and Moviedata.php are introduced.

When I attempt to run Createmovie.php I get the "Hey loser, check your server connection." message. I have replaced localhost, username & passwords with MySQL settings (at least I think I have - I am not 100% sure if they are correct but wouldn't I get a different error message?) Is there any way I can check these details?

Here's my code:
 
Quote:
quote:<?php
Quote:
//connect to MySQL; note we’ve used our own parameters- you should use
//your own for hostname, user, and password
$connect = mysql_connect("localhost", "root", "MYPASSWORD") or
     die ("Hey loser, check your server connection.");

//create the 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($movie)
  or die (mysql_error());

//create "movietype" table
$movietype = "CREATE TABLE movietype (
  movietype_id int(11) NOT NULL auto_increment,
  movietype_label varchar(100) NOT NULL,
  PRIMARY KEY (movietype_id)
) TYPE=MyISAM AUTO_INCREMENT=9" ;

$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!";
?>
Thanks in advance for any assistance offered!
GG
Reply With Quote
  #2 (permalink)  
Old March 2nd, 2005, 11:46 AM
Registered User
 
Join Date: Feb 2005
Location: Bangkok, , Thailand.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Uninstalled all references to MySQL on my PC and installed 4.0.23 and viola - it works!! :D

Reply With Quote
  #3 (permalink)  
Old April 6th, 2005, 06:36 AM
Registered User
 
Join Date: Apr 2005
Location: staveley, , United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

If you get a Line 8 error, then change the statement to

$query = mysql_query("CREATE DATABASE wiley") or die(mysql_error());

this is listed in the error pages and does work.

I worked through my connection errors in line 4, then continued on to sort errors line 8. I just wish that the error codes where a little more specific. (I am using Apache 2, PHP 4.3 and Mysql 4.1 - which in itself causes problems as there are bits added /taken away and changed in the code).

Hope this helps

Gareth, UK
Reply With Quote
  #4 (permalink)  
Old April 6th, 2005, 10:46 AM
Registered User
 
Join Date: Feb 2005
Location: Bangkok, , Thailand.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for taking the time to respond Gareth.

I'll certainly add your suggestion to my "Tips" collection.

Cheers,
GG

Reply With Quote
Reply


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
Chapter 2 - Create a new virtual machine nclattimer BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 2 July 8th, 2008 12:04 PM
Wiley Image!!! mike_remember Forum and Wrox.com Feedback 5 August 14th, 2007 10:11 AM
Source Code for a book not taken up by Wiley sbagnall ASP.NET 1.0 and 1.1 Basics 0 April 26th, 2006 09:31 AM



All times are GMT -4. The time now is 10:56 PM.


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