Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 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 March 28th, 2013, 01:30 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Admin.php

Hi all

I am completely new to PHP and I have taken the code directly from the download source of this publishing book. I wanted to see it all working first before I delved in. So I can display my admin.php which shows a table with the add, edit and delete options visible. As soon as I select either the add or edit option, I get the following error

The web page at http://localhost:8080/movies/movie.php?action=add might be temporarily down or it may have moved permanently to a new web address.
Error 103 (net::ERR_CONNECTION_ABORTED): Unknown error.

Reading this above I understand that it is trying to go to the movie.php but cannot get there. I can confirm that movie.php is there.

Yet if I pick the delete option it does ask me do I want to delete the record, which tells me that the delete.php is been read.

Bear with me, as this might just be an easy answer, but I am completely new.

Thanks

Cottsie
Reply With Quote
  #2 (permalink)  
Old August 17th, 2013, 06:19 AM
Registered User
Points: 33, Level: 1
Points: 33, Level: 1 Points: 33, Level: 1 Points: 33, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Post admin.php add

Code:
hi
may it will help you:

<?php
$db=mysql_connect('localhost', 'bp6am', 'bp6ampass') or die('Unable to connect. Check your connection parameters!');
mysql_select_db('moviesite', $db) or die(mysql_error($db));
if($_GET['action'] == 'edit') {

			//retrieve the record’s information
			$query='SELECT
				movie_name, movie_type, movie_year, movie_leadactor,
				movie_director
				FROM
				movie
				WHERE
				movie_id = ' . $_GET['id'];
			$result=mysql_query($query, $db) or die(mysql_error($db));
			extract(mysql_fetch_assoc($result));

} else {
	//Set velues to blank ESEIGI $_GET['action'] == [ADD]-s amitom qvedebi arian 0-ebi anu carielebi rom airchio shenit
	$movie_name='';
	$movie_type=0;
	$movie_year=date("Y");
	$movie_leadactor=0;
	$movie_director=0;
}
?>

<html>
<head><title><?php echo ucfirst($_GET['action']); ?> Movie</title>
</head>
<body>

<form action="commit.php?action=<?php echo $_GET['action']; ?>& type=movie"
method="post">
<table>
	<tr>
	<td>Movie Name</td>
	<td><input type="text" name="movie_name"	value="<?php echo $movie_name; ?>" /></td>
						<!--value="..." imitoa ase rom tu $_GET['action']==[EDIT] name velshi 							dagxvdes "axla shecvlamde" arsebuli "movie_name"-i, romelic "movie" table-shia-->
	</tr><tr>
	<td>Movie Type</td>
	<td><select name="movie_type">
<?php
	// select the movie type information
$query='SELECT 
	movietype_id, movietype_label
	FROM
	movietype
	ORDER BY 
	movietype_label';
$result=mysql_query($query, $db) or die(mysql_error($db));
	// populate the select options with the results

while ($row = mysql_fetch_assoc($result)) {
foreach ($row as $value) {
	if($row['movietype_id'] == $movie_type) {
echo '<option value="' . $row['movietype_id'] . '
	"selected=selected">';
	} else {
echo '<option value="' . $row['movietype_id'] . '">';
	}
echo $row['movietype_label'] . '</option>';
}
}
?>
</select></td>
</tr><tr>
	<td>Movie Year</td>
	<td><select name="movie_year">
<?php
	// populate the select options with years
for($yr=date("Y"); $yr >=1970; $yr--) {
	if($yr == $movie_year) {
	echo '<option value="' . $yr . '" selected="selected">' .
		$yr . '</option>';
	} else {
		echo '<option value="' . $ye . '">' . $yr . '</option>';
	}
}
?>
</select></td>
	</tr><tr>
	<td>Lead Actor</td>
	<td><select name="movie_leadactor">
<?php
$query='SELECT
	people_id, people_fullname
	FROM
	people
	WHERE
	people_isactor= 1
	ORDER BY
	people_fullname';
$result=mysql_query($query, $db) or die(mysql_error($db));

	// populate the select options with the results
while($row=mysql_fetch_assoc($result)) {	
	foreach($row as $value) {
		if($row['people_id'] == $movie_leadactor) {
		     echo '<option value="' . $row['people_id'] . '" selected="selected">';
		} else {
	echo '<option value="' . $row['people_id'] . '">'; 
		}
	echo $row['people_fullname'] . '</option>';
	}
}
?>
</select></td>
	</tr><tr>
	<td>Movie Director</td>
	<td><select name="movie_director">
<?php
	// select director records
$query='SELECT
	people_id, people_fullname
	FROM
	people
	WHERE
	people_isdirector = 1
	ORDER BY
	people_fullname';
$result=mysql_query($query, $db) or die(mysql_error($db));

	// populate the select options with the results
while($row=mysql_fetch_assoc($result)) {
	foreach($row as $value) {
		if($row['people_id'] == $movie_director) {
	echo '<option value="' . $row['people_id'] . '" selected="selected">';
		} else {
		echo '<option value="' . $row['people_id'] . '">';
		}
	echo $row['people_fullname'] . '</option>';
	}	
}
?>
</select></td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
		<?php
		if($_GET['action'] == 'edit') {
			echo '<input type="hidden" value="' . $_GET['id'] . '"  name="movie_id" />';
		}
		?>

	<input type="submit" name="submit" value="<?php echo ucfirst($_GET['action']); ?>" />
</td>
</tr>
</table>
</form>
</body>
</html>
Reply With Quote
  #3 (permalink)  
Old August 17th, 2013, 10:47 AM
Registered User
Points: 33, Level: 1
Points: 33, Level: 1 Points: 33, Level: 1 Points: 33, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation If

P.S.
if select boxes will list items show twice - please remove foreach(...) fonctions in the While () loops
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
Chap 10 - issues with admin.php file kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 12th, 2010 09:08 PM
Ch. 6 - admin.php - HELP drgnhiker BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 8 February 13th, 2010 12:22 AM
I can't login admin account all chapter ? pop99 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 June 4th, 2006 05:17 AM
Forum admin.php LCMatt PHP How-To 0 March 18th, 2006 06:27 PM



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


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