Jump to content

[SOLVED] Whats wrong with this code?


curt22

Recommended Posts

<?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'] . " " . $row['verse text'];
echo "<br/>";
}

?>
Link to comment
https://forums.phpfreaks.com/topic/31423-solved-whats-wrong-with-this-code/
Share on other sites

He already told you what's wrong with it.
Single quotes wont interpret variables, only double quotes will.

BTW, if you are trying to put the whole bible into a mysql database, you're reinventing the wheel. Use the Sword project's diatheke instead. That way you can switch translations on a whim and its search response times are pretty amazing.
[code]
<?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 "\n$row[testimate] $row[book] $row[chapter]:$row[verse] <pre>\n$row[verse_text]</pre>";
}
?>[/code]

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.