Jump to content

[SOLVED] sorting information in php and mysql


curt22

Recommended Posts

I'm new to php and mysql and I need to have the results sorted.
First its needs to sort by book.
then by chapters inside the books.
Then by verse.
For example:
if its like this now:
id  testimate  book              chapter  verse
1    old            genesis          1              1
2    old            Exodus          2              1
3    old            genesis          2              2
it would look like this after being sorted:
1    old            genesis          1              2
3    old            genesis          2              2
2    old            Exodus          2              1
the code im using to show the databse is:
<?php
include 'connect.php';
$sql = 'SELECT * FROM bible WHERE MATCH($_post[\'field\'])'
        . ' AGAINST(\'$_post[\'find\']\'  IN BOOLEAN MODE) LIMIT 0, 30 ';
$result = mysql_query($sql) or die(mysql_error());

while($row = mysql_fetch_array($result)){
echo $row['testimate'] . " " . $row['book'] . " " . $row['chapter'] . " " . $row['verse'];
echo "<br/>";
}

?>
??? ??? ??? ??? ???
Ok this is as much as i can get could you please tell me what to do with it?

<?php

include 'connect.php';
$query = "SELECT * FROM bible ORDER BY bookid";
$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){
echo $row['testimate'] . " " . $row['book'] . " " . $row['chapter'] . " " . $row['verse'] . " " . $row['verse text'];
echo "<br/>";
}



?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.