View Single Post
  #2 (permalink)  
Old 10-17-2008, 09:14 PM
cphale cphale is offline
Registered User
 
Join Date: Oct 2007
Location: Worcester, U.K.
Posts: 5
Quote:
Originally Posted by gilgalbiblewhee View Post
I don't understand why the sql isn;t working in the for loop:
$booktitlesarray[] = "<span class='goToBookChapter' style='font-weight: bold;'>".$row['book_title']." ".$row['chapter'].":".$row['verse']."</span><br />".$row['text_data']."<br />";
Hi,
you've not specified an index for $booktitlesarray,

Declare a variable and initialise it as "0", like so : $bookcount = 0;

Then use this as the index of the array and increment it; $booktitlesarray[$bookcount++] = "<span... etc.

Like so;

if($result){
$bookcount = 0;
while($row = mysql_fetch_assoc($result)){
$booktitlesarray[$bookcount++] = "<span class='goToBookChapter' style='font-weight: bold;'>".$row['book_title']." ".$row['chapter'].":".$row['verse']."</span><br />".$row['text_data']."<br />";
}
}
Reply With Quote