Wrox Programmer Forums
|
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 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 August 18th, 2009, 10:36 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populating table (table1-rev02) not working

Hello. I've been working through chapter 4 and trying to work on my own revision of the page in the document. However, when I attempt to load it I get a blank page. Currently here is the page that I have written.

Code:
<?php
//connect to MySQL; 
$link= mysql_connect("localhost", "xxxx", "xxxxx") 
	or die (mysql_error());

	//make sure we're using the right database
mysql_select_db("prod_mgmt")
	or die (mysql_error());
$query = "SELECT pl_id, pl_name " .
"FROM product_line";


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

$product_header=<<<EOD
<h2><center>Product Database</center></h2>
<table width="70%" border="1" cellpadding="2" cellspacing="2" align="center">
  <tr>
    <th>PL ID</th>
    <th>Product Line Name</th>
  </tr>
</table>
EOD;
$product_details = '';
while ($row = mysql_fetch_array($result)) {
  $pl_id = $row['pl_id']; 
  $pl_name = $row['pl_name'];

  $product_details .=<<<EOD
  <tr>
    <td>$pl_id</td>
    <td>$pl_name</td>
  </tr>
EOD;
}


$product_details .=<<<EOD
<tr>
<td>$nbsp;</td>
</tr>
<tr>
<td>Total: $num_products Products</td>
</tr>
EOD;

$product_details .=<<<EOD
  <tr>
   <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Total :$num_products Products</td>
  </tr>
EOD;
?>
I have edited the page multiple times and I believe the issue comes down to this section of the page.

Code:
$product_details = '';
while ($row = mysql_fetch_array($result)) {
  $pl_id = $row['pl_id']; 
  $pl_name = $row['pl_name'];

  $product_details .=<<<EOD
  <tr>
    <td>$pl_id</td>
    <td>$pl_name</td>
  </tr>
EOD;
}


$product_details .=<<<EOD
<tr>
<td>$nbsp;</td>
</tr>
<tr>
<td>Total: $num_products Products</td>
</tr>
EOD;

$product_details .=<<<EOD
  <tr>
   <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Total :$num_products Products</td>
  </tr>
EOD;
?>
Any assistance on where the problem is would be greatly appreciated.
 
Old August 18th, 2009, 12:11 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A friend showed me how to find the issue. The blank page was the hard part to solve.

However, to find the issue on the linux box I was running everything on, I called "php [phpfile]" and it outputted the error.

I hope this helps others.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating an unbound form from a table Luis Access VBA 8 November 21st, 2008 08:37 AM
Chapter 4 "Populating the Table" Chudz BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 August 24th, 2007 01:31 PM
Populating new table young20 Access VBA 1 November 15th, 2006 08:20 AM
Querying table2 with results from table1 miamikk SQL Language 3 November 9th, 2006 09:22 AM
Generate unique ID when populating a table sroman SQL Server 2000 2 August 5th, 2003 03:38 AM





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