Wrox Programmer Forums
|
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 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 February 27th, 2005, 10:38 AM
Registered User
 
Join Date: Feb 2005
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
 
Old March 2nd, 2005, 11:46 AM
Registered User
 
Join Date: Feb 2005
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

 
Old April 6th, 2005, 06:36 AM
Registered User
 
Join Date: Apr 2005
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
 
Old April 6th, 2005, 10:46 AM
Registered User
 
Join Date: Feb 2005
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






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





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