Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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 Display Modes
  #1 (permalink)  
Old June 6th, 2014, 07:31 AM
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: Jun 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Post Chapter 4 replenishment tables

1. Sorry if have problem with my english, it's not so good.
2. I want to ask little help to understand one example from chapter 4 with replenishment information in tables.

The Example: table 2.php

Quote:
<?php

include("mysql_connect.php");


?>

<HEAD>
<TITLE>MYSQL TABLE</TITLE>
</HEAD>
<BODY>

<?php

mysql_select_db("moviesite");

$query = "SELECT movie_name, movie_director, movie_leadactor FROM movie";

$result = mysql_query($query) or die (mysql_error());

$num_movies = mysql_num_rows($result);

$movie_header =<<<EOD
<h2><center><b><i><font color=red> Страница за преглед на филми! </font color></b></i></center></h2>
<table width = "70%" border = "1" cellpadding = "2" cellspacing = "2" align = "center">
<tr>
<th bgcolor=#C2C2C2> Заглавие </th>
<th bgcolor=#C2C2C2> Режисьор </th>
<th bgcolor=#C2C2C2> Актьори </th>
</tr>

EOD;

//Функция за вземане на имената на директорите

function get_director() {
global $movie_director;
global $director;

$query_d = "SELECT people_fullname FROM people " .
"WHERE people_id = '$movie_director'";

$results_d = mysql_query($query_d) or die (mysql_error());

$row_d = mysql_fetch_array($results_d);
extract($row_d);
$director = $people_fullname;
}

// Функция за вземане на имената на артистите

function get_leadactor() {
global $movie_leadactor;
global $leadactor;

$query_a = "SELECT people_fullname FROM people " .
"WHERE people_id = '$movie_leadactor'";

$results_a = mysql_query($query_a) or die (mysql_error());

$row_a = mysql_fetch_array($results_a);
extract($row_a);
$leadactor = $people_fullname;
}


$movie_details = '';
while ($row = mysql_fetch_array($result)) {
$movie_name = $row['movie_name'];
$movie_director = $row['movie_director'];
$movie_leadactor = $row['movie_leadactor'];

get_director();
get_leadactor();

$movie_details .=<<<EOD
<tr>
<td bgcolor=eaeaea> $movie_name </td>
<td bgcolor=eaeaea> $director </td>
<td bgcolor=eaeaea> $leadactor </td>
</tr>
EOD;
}

$movie_details .=<<<EOD
<tr>
<td> </td>
</tr>
<tr>
<td> Всички филми са общо: $num_movies !</td>
</tr>
EOD;

$movie_footer = "</table>";

$movie =<<<EOD
$movie_header
$movie_details
$movie_footer
EOD;

echo "В нашата база има $num_movies филма";
echo $movie;


?>


</BODY>
My database is with different names of movie and actors, and different numbers of them, but structure is same as in the book!

End result not have errors, table in browser I have table with name of movie, directors and actors.

In column with moves, name of movies is these who must be.
In columns with director and actor is not the name who must be! Shuffle!

---

I try to find why and this and I get the funcions

function get_director() {
global $movie_director;
global $director;

$query_d = "SELECT people_fullname FROM people " .
"WHERE people_id = '$movie_director'";
...
}

and

function get_leadactor() {
global $movie_leadactor;
global $leadactor;

$query_a = "SELECT people_fullname FROM people " .
"WHERE people_id = '$movie_leadactor'";

...
}

In this function I understand, that the php get names from people_fullname from table people, and names are sent in $move_director/leadactor.

I can't understand how to php understand who is director and who is actor.
And my browser don't understand.

I think, that the results is send, without to look who is director or actor!

And How I understand who director is on who movie and his actors?

I make test with downloaded file from this site "table2.php.04": result is same!

May be I am in wrong somewhere!

From where I can post image?

http://bg-media.net/moviesite/table1.php
http://bg-media.net/moviesite/table2.php

if u import DB who is example in book - All seem Alright! If have make change in table "people" the result is not good!

Last edited by Lubaka; June 10th, 2014 at 09:37 AM. Reason: import image
Reply With Quote
Reply


Thread Tools
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
Where are the tables created /Chapter 3 codesmart BOOK: Beginning Spring Framework 2 ISBN: 978-0-470-10161-2 2 August 13th, 2008 07:53 AM
creating tables within tables in access??? carswelljr Access 3 August 23rd, 2006 01:21 PM
Using tables to display data (chapter 4) gadjodilo BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 5 August 7th, 2006 01:42 PM
Creating database and tables. chapter 9 PeterJB BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 August 1st, 2006 06:52 AM
chapter 12, can't set up tables robtho BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 January 7th, 2006 03:38 PM



All times are GMT -4. The time now is 06:01 PM.


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