[this problem solved already see next post]
Hi i'm a beginner at php and my simple web query page doesn't work.. i swear i had it working at one point but now i've come back to it it doesn't.
• My form works
• My DB connection works
• My query works in my client... so it should work here. It has the right DB and all the right table names... i've only changed the word = 'myword' to word = '$word' so it will use the form value instead.
• My while loop doesn't return results.. it goes to the "else { echo 'Bad Search';"... but i can't see anything wrong with it :( no error messages... I'm stumped...
[PHP]<?php
$word = $_REQUEST['word'];
echo '<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
<td><form action="find.php" method="get">
<p><font color="666666" face="Arial" size="3"><b>Find</b></font>
<input type="text" name="word" size="30" maxlenght="30" />
<input type="submit" name="Get" value="Go"/></p>
</form></td>
</tr>
</table>
';
require_once ('mysql_connect.php');
$query = "SELECT c.cid as ID, c.title as title FROM s
INNER JOIN c
ON s.cID = c.cID
AND s.wID = (SELECT wid FROM w WHERE word = '$word')";
$result = @mysql_query ($query);
if ($result) {
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo '<table><tr><td align="left">' . $row['ID'] . '</td></tr><tr><td align="left">' . $row['title'] . '</td></tr></table>';
}
mysql_free_result ($result);
} else { echo 'Bad Search';
}
mysql_close();
?>[/PHP]