I have a Bible database and I need help writing the query a little bit of styling.
I want to display all the books and chapters (which will be linked to another page -passage.php) that will display all the verses in that chapter. Here's waht I'd like it to look like:
[PHP]http://www.biblegateway.com/versions/?action=getVersionInfo&vid=49[/PHP]
I've tried this but it goes all the way across the screen and I get like 28+ of each chapter. That times 50 chapters for Genesis...
[PHP]<table width='95%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<th>Book</th>
<th>Chapters</th>
</tr>
<tr>
<?php
include("includes/dbinfobible.inc.php");
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT book FROM bibleasv WHERE book='Genesis'";
$result=mysql_query($query) or die('Error, query failed mysql said <b>'.mysql_error().'</b>');
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$book = stripslashes($row['book']);
}
echo "
<td style='white-space: nowrap;'>$book</td>
<td>
";
$query="SELECT chapter FROM bibleasv WHERE book='$book'";
$result=mysql_query($query) or die('Error, query failed mysql said <b>'.mysql_error().'</b>');
$num=mysql_numrows($result);
$i=0;
while ($i < $num)
{
$chapter = mysql_result($result,$i,"chapter");
echo "<a href='passage.php?file=$chapter'>$chapter</a> ";
++$i;
}
?>
</tr>
</table>[/PHP]
How to I get the chapters to drop down to another line instead of going across the screen?