Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases 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 April 11th, 2005, 03:04 PM
Registered User
 
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default It wont Connect toMySQLChapter 3,Page 95-98,

It wont connect to MySQL Server 4.1 from PHp runnunig the code below. This is the very 1st time i try to build a DataBase at all.
Can not get it to work. ""HELP PLEASE"!!
"I have been stock for days now." FROM A BEGINER (alevele@hotmai.com)
MYSQL SERVER 4.1

ERROR output Mesage ON BROWSER:

---Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Program Files\Apache Group\Apache2\Test\createmovie.php on line 8
Hey check yourn connection.---

CODE:
<body>

<?php
-LINE 8- $connect = mysql_connect("localhost", "root", "MYPASSWORD") or die ("Hey check yourn connection.");

//Create a Data base
mysql_create_db("wiley")
or die(mysql_error());

// verify the current DB is the activeone
mysql_select_db ("wiley");

//Create "movie" table
$movie = "CREATE TEBLE 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 (people_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 sucesfully created! ";
?>

</body>
</html>
 
Old April 13th, 2005, 10:10 AM
Registered User
 
Join Date: Apr 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to add the following to your my.ini file
(Mine is placed after the Server section under [mysqld])

old-passwords

After adding it, restart mysql and/or your system

Quote:
quote:Originally posted by Alej
 It wont connect to MySQL Server 4.1 from PHp runnunig the code below. This is the very 1st time i try to build a DataBase at all.
Can not get it to work. ""HELP PLEASE"!!
"I have been stock for days now." FROM A BEGINER (alevele@hotmai.com)
MYSQL SERVER 4.1

ERROR output Mesage ON BROWSER:

---Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Program Files\Apache Group\Apache2\Test\createmovie.php on line 8
Hey check yourn connection.---

CODE:
<body>

<?php
-LINE 8- $connect = mysql_connect("localhost", "root", "MYPASSWORD") or die ("Hey check yourn connection.");

//Create a Data base
mysql_create_db("wiley")
or die(mysql_error());

// verify the current DB is the activeone
mysql_select_db ("wiley");

//Create "movie" table
$movie = "CREATE TEBLE 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 (people_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 sucesfully created! ";
?>

</body>
</html>
 
Old April 16th, 2005, 03:21 PM
Registered User
 
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I did set up my password by using :
"set password for root@loacalhost=password('your_password');
log out "\q", and then log back with:
mysql -u root -p,
prompts for password! 'yourpassword'
and then I get the wellcome monitor screen.
then I make sure I place the same password in my PHP script, at hte
mysql_connect () function.
and I now get : Can't create database 'wiley'. Database exists.
My hole next week will be dvoted to this message NOW..


Quote:
quote:Originally posted by vaderj
 You need to add the following to your my.ini file
(Mine is placed after the Server section under [mysqld])

old-passwords

After adding it, restart mysql and/or your system

Quote:
quote:Originally posted by Alej
 It wont connect to MySQL Server 4.1 from PHp runnunig the code below. This is the very 1st time i try to build a DataBase at all.
Can not get it to work. ""HELP PLEASE"!!
"I have been stock for days now." FROM A BEGINER (alevele@hotmai.com)
MYSQL SERVER 4.1

ERROR output Mesage ON BROWSER:

---Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Program Files\Apache Group\Apache2\Test\createmovie.php on line 8
Hey check yourn connection.---

CODE:
<body>

<?php
-LINE 8- $connect = mysql_connect("localhost", "root", "MYPASSWORD") or die ("Hey check yourn connection.");

//Create a Data base
mysql_create_db("wiley")
or die(mysql_error());

// verify the current DB is the activeone
mysql_select_db ("wiley");

//Create "movie" table
$movie = "CREATE TEBLE 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 (people_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 sucesfully created! ";
?>

</body>
</html>
 
Old August 29th, 2006, 11:37 PM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have been working on the same file. Did you ever get yours to work? I received the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'people_isactor tinyint(1) NOT NULL default 0, PRIMARY KEY (people_id) )' at line 4

Here is the code:

$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)








Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 Page 95 jumpot89 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 6 April 22nd, 2009 03:11 AM
Chapter 3 page 95 nead23 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 March 26th, 2009 09:28 AM
Chapter 3, page 95 Swerve1000 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 May 29th, 2007 04:45 PM
Getversion issue with Windows 95/98 ? maxpotters Beginning VB 6 2 August 4th, 2005 08:40 AM





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