It's been ages since I played with PHP but I'm back at it and I've got a problem. Of course when I have a problem, I come here...
I want to separate 3 results that are taken from 1 mysql query. This is as far as I've gotten:
$prev_verse = $_GET['verse'] - 1;
$next_verse = $_GET['verse'] + 1;
$sql = @mysql_query("SELECT text FROM bible_ot WHERE book = '$_GET[book]' AND
chapter = '$_GET[chapter]' AND verse = '$prev_verse' OR book = '$_GET[book]' AND
chapter = '$_GET[chapter]' AND verse = '$_GET[verse]' OR book = '$_GET[book]' AND
chapter = '$_GET[chapter]' AND verse = '$next_verse'");
I know there's a big while statement or something that I need but I'm lost now... I just can't figure out how to manipulate arrays the way I want. Eg: Put it all into an array "mysql_fetch_array" then separate them into their own variables or callable id's ($var[first statement], $var[second statement], etc.) Main thing is, I want to break that array up into 3 variables so I can use each one individually rather than limit them all to that one while statement.
I want to separate 3 results that are taken from 1 mysql query. This is as far as I've gotten:
Code:
$prev_verse = $_GET['verse'] - 1;
$next_verse = $_GET['verse'] + 1;
$sql = @mysql_query("SELECT text FROM bible_ot WHERE book = '$_GET[book]' AND
chapter = '$_GET[chapter]' AND verse = '$prev_verse' OR book = '$_GET[book]' AND
chapter = '$_GET[chapter]' AND verse = '$_GET[verse]' OR book = '$_GET[book]' AND
chapter = '$_GET[chapter]' AND verse = '$next_verse'");
I know there's a big while statement or something that I need but I'm lost now... I just can't figure out how to manipulate arrays the way I want. Eg: Put it all into an array "mysql_fetch_array" then separate them into their own variables or callable id's ($var[first statement], $var[second statement], etc.) Main thing is, I want to break that array up into 3 variables so I can use each one individually rather than limit them all to that one while statement.