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 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 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 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.
Reply With Quote
  #2 (permalink)  
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.
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
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



All times are GMT -4. The time now is 04:34 AM.


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