Page 2 of 2

Posted: Mon Aug 07, 2006 9:36 am
by feyd
Count your braces. You have an extra one somewhere.

Posted: Mon Aug 07, 2006 10:36 am
by bruceg
I took out a brace that looked like it didn't belong, but that didn't fix the problem.

I now have:

Code: Select all

<?php
ini_set('display_errors', 'On')
error_reporting(E_ALL);
//db connect and select 
$db_name="bruceg_friends-family"; 
$table_name ="address_book"; 
$connection = @mysql_connect("208.65.62.13", "bruceg_webmaster", "phoenix") 
or die (mysql_error()); 
$db = @mysql_select_db($db_name, $connection) or die (mysql_error()); 

$result=mysql_query ("select * from address_book"); 
$resultCount = mysql_num_rows($result); 

if ($resultCount > 0)   {  // make sure we have data to display 

echo<<<TABLETOP 
<table border="0" cellspacing="0" cellpadding="10" align="center"> 
<tr> 
<th>id</th> 
    <th>Name</th> 
    <th>address1</th> 
    <th>address2</th> 
    <th>zip</th> 
    <th>primary phone</th> 
    <th>Seconday phone</th> 
    <th>notes</th> 
   </tr> 
TABLETOP; 
while ($row = mysql_fetch_assoc($result)) {  // Display the data from mysql 
echo<<<TABLEDATA 
  <tr> 
    <td>{$row['id']}</td> 
    <td>{$row['Name']</td> 
    <td>{$row['address1']</td> 
    <td>{$row['addres2']</td> 
    <td>{$row['zip']</td> 
    <td>{$row['primary_phone']</td> 
    <td>{$row['2ndary_phone']</td> 
    <td>{$row['notes']</td> 
  </tr> 
TABLEDATA; 

}  //  End while 

echo "</table>"; 

}  // End if 


?>
if someone has a php debugging program, they could test this on, I would greatly appreciate it.

Posted: Mon Aug 07, 2006 10:41 am
by feyd
You're missing a semicolon.

Posted: Mon Aug 07, 2006 10:56 am
by blackbeard
bruceg wrote:I took out a brace that looked like it didn't belong, but that didn't fix the problem.

I now have:

Code: Select all

<?php
ini_set('display_errors', 'On')
error_reporting(E_ALL);
//db connect and select 
$db_name="bruceg_friends-family"; 
$table_name ="address_book"; 
$connection = @mysql_connect("208.65.62.13", "bruceg_webmaster", "phoenix") 
or die (mysql_error()); 
$db = @mysql_select_db($db_name, $connection) or die (mysql_error()); 

$result=mysql_query ("select * from address_book"); 
$resultCount = mysql_num_rows($result); 

if ($resultCount > 0)   {  // make sure we have data to display 

echo<<<TABLETOP 
<table border="0" cellspacing="0" cellpadding="10" align="center"> 
<tr> 
<th>id</th> 
    <th>Name</th> 
    <th>address1</th> 
    <th>address2</th> 
    <th>zip</th> 
    <th>primary phone</th> 
    <th>Seconday phone</th> 
    <th>notes</th> 
   </tr> 
TABLETOP; 
while ($row = mysql_fetch_assoc($result)) {  // Display the data from mysql 
echo<<<TABLEDATA 
  <tr> 
    <td>{$row['id']}</td> 
    <td>{$row['Name']}</td> 
    <td>{$row['address1']}</td> 
    <td>{$row['addres2']}</td> 
    <td>{$row['zip']}</td> 
    <td>{$row['primary_phone']}</td> 
    <td>{$row['2ndary_phone']}</td> 
    <td>{$row['notes']}</td> 
  </tr> 
TABLEDATA; 

}  //  End while 

echo "</table>"; 

}  // End if 


?>
if someone has a php debugging program, they could test this on, I would greatly appreciate it.
I forgot the second half of the curly braces for the $row data inside the while loop. Try it now.

Also, is there actual data in the table? if not, that you'll see nothing because of the if statement.

Posted: Mon Aug 07, 2006 10:57 am
by bruceg
I added the missing ; and this is what I now have. Still a blank page :-(

Code: Select all

<?php
ini_set('display_errors', 'On')
error_reporting(E_ALL);
//db connect and select 
$db_name="bruceg_friends-family"; 
$table_name ="address_book"; 
$connection = @mysql_connect("208.65.62.13", "bruceg_webmaster", "phoenix"); 
or die (mysql_error()); 
$db = @mysql_select_db($db_name, $connection) or die (mysql_error()); 

$result=mysql_query ("select * from address_book"); 
$resultCount = mysql_num_rows($result); 

if ($resultCount > 0)   {  // make sure we have data to display 

echo<<<TABLETOP 
<table border="0" cellspacing="0" cellpadding="10" align="center"> 
<tr> 
<th>id</th> 
    <th>Name</th> 
    <th>address1</th> 
    <th>address2</th> 
    <th>zip</th> 
    <th>primary phone</th> 
    <th>Seconday phone</th> 
    <th>notes</th> 
   </tr> 
TABLETOP; 
while ($row = mysql_fetch_assoc($result)) {  // Display the data from mysql 
echo<<<TABLEDATA 
  <tr> 
    <td>{$row['id']}</td> 
    <td>{$row['Name']</td> 
    <td>{$row['address1']</td> 
    <td>{$row['addres2']</td> 
    <td>{$row['zip']</td> 
    <td>{$row['primary_phone']</td> 
    <td>{$row['2ndary_phone']</td> 
    <td>{$row['notes']</td> 
  </tr> 
TABLEDATA; 

}  //  End while 

echo "</table>"; 

}  // End if 


?>

Posted: Mon Aug 07, 2006 11:02 am
by feyd
I'm still seeing missing semicolons and braces.

Posted: Mon Aug 07, 2006 11:09 am
by blackbeard

Code: Select all

<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
//db connect and select 
$db_name="bruceg_friends-family"; 
$table_name ="address_book"; 
$connection = @mysql_connect("208.65.62.13", "bruceg_webmaster", "phoenix") or die (mysql_error()); 
$db = @mysql_select_db($db_name, $connection) or die (mysql_error()); 

$result=mysql_query ("select * from address_book"); 
$resultCount = mysql_num_rows($result); 

if ($resultCount > 0)   {  // make sure we have data to display 

echo<<<TABLETOP 
<table border="0" cellspacing="0" cellpadding="10" align="center"> 
<tr> 
<th>id</th> 
    <th>Name</th> 
    <th>address1</th> 
    <th>address2</th> 
    <th>zip</th> 
    <th>primary phone</th> 
    <th>Seconday phone</th> 
    <th>notes</th> 
   </tr> 
TABLETOP; 

while ($row = mysql_fetch_assoc($result)) {  // Display the data from mysql 
echo<<<TABLEDATA 
  <tr> 
    <td>{$row['id']}</td> 
    <td>{$row['Name']}</td> 
    <td>{$row['address1']}</td> 
    <td>{$row['addres2']}</td> 
    <td>{$row['zip']}</td> 
    <td>{$row['primary_phone']}</td> 
    <td>{$row['2ndary_phone']}</td> 
    <td>{$row['notes']}</td> 
  </tr> 
TABLEDATA; 

}  //  End while 

echo "</table>"; 

}  // End if 


?>
Double checked myself, I don't see anything missing now.

Posted: Mon Aug 07, 2006 11:15 am
by bruceg
that worked finally :-)

thanks for all of your assistance guys

Posted: Mon Aug 07, 2006 12:46 pm
by bruceg
sorry to be difficult, but since their are 8 different fields to be displayed, I am needing to break them up some so that four records would display on top and four records on the bottom.

the html code would need to look like

Code: Select all

<table>
<tr>
<th></th><th></th><th></th><th></th>
</tr>
<tr>
</td><td></td><td></td></td><td></td>
</tr>
<tr>
<th></th><th></th><th></th><th></th>
</tr>
<tr>
</td><td></td><td></td></td><td></td>
</tr>
</table>


I am not sure the best way to do that given the code I am using previously given in this thread.

thanks

Posted: Mon Aug 07, 2006 12:51 pm
by feyd
Have a read through the first two links in Useful Posts.