Welcome! Log In Create A New Profile

Advanced

How I can sought out this issue with MySQL issue of chapter 3 in the handbook.

Posted by Anonymous User 
Announcements Last Post
Announcement myUnisa availability 21 to 24 March 2019 03/17/2019 02:24PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'bp5am'@'localhost' (using password: YES) in C:\Program Files\xampp\htdocs\StudentPHP\createmovie.php on line 4
Hey loser, check your server connection.

****
<?php
//connect to MySQL; note we've used our own parameters- you should use
//your own for hostname, user, and password
$connect = mysql_connect("localhost", "bp5am", "bp5ampass"winking smiley or
die ("Hey loser, check your server connection."winking smiley;

//create the main database if it doesn't already exist
$create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite"winking smiley
or die(mysql_error());

//make sure our recently created database is the active one
mysql_select_db("moviesite"winking smiley;

//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)
)";

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

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

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

echo "Movie Database successfully created!";

?>

***** (The 2nd assistance required from chapter 3 in the handbook)

<?php
//connect to MySQL
$connect = mysql_connect("localhost", "bp5am", "bp5ampass"winking smiley
or die("Hey loser, check your server connection."winking smiley;

//make sure we're using the right database
mysql_select_db("moviesite"winking smiley;

$query = "SELECT movie_name, movie_type " .
"FROM movie " .
"WHERE movie_year>1990 " .
"ORDER BY movie_type";
$results = mysql_query($query)
or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
extract($row);
echo $movie_name;
echo " - ";
echo $movie_type;
echo "<br>";
}

?>
avatar
Mac
Re: How I can sought out this issue with MySQL issue of chapter 3 in the handbook.
March 30, 2009 07:38AM
Well, if access is denied then the user rights are not correct in the mysql database, either in the user and/or db tables.

You can add/edit directly there (requires a restart from mysql on front page of phpmyadmin.

Or do as here http://wiki.uniformserver.com/index.php/MySQL_phpMyAdmin
or Google for phpmyadmin create user for similar pages.
Sorry, only registered users may post in this forum.

Click here to login