I have this search script that I use. It does not return any results even when I input data I know is in the database. Here is code:
PHP Code:
<?php /* call this script "this.php" */ if ($c != 1) { ?> <form action="this.php?c=1"> <input type="text" name="keyword"> <input type="submit" value="Search!"> </form> <?php } else if ($c==1) { MySQL_connect("localhost", "*****", "*****"); MySQL_select_db("testdb"); $sql = " SELECT *, MATCH(coords, name, owner) AGAINST('$keyword') AS score FROM planets WHERE MATCH(coords, name, owner) AGAINST('$keyword') ORDER BY score DESC "; $res = MySQL_query($sql); ?> <table> <tr><td>SCORE</td><td>Coords</td><td>Name</td></tr> <?php while($row = MySQL_fetch_array($rest)) { echo "<tr><td>{$sql2['score']}</td>"; echo "<td>{$sql2['coords']}</td>"; echo "<td>{$sql2['name']}</td></tr>"; } echo "</table>"; } ?>
Can someone please help me as I am very new to this.
|