- Impact
- 18
PHP:
<?php
include('config.php');
if( isset($_POST['q']) ){
// if a form was submitted
$sql = "SELECT * FROM ".$config['table']." WHERE MATCH (".$config['name'].",".$config['type'].",".$config['glass'].") AGAINST ('".$_POST['q']."')";
$result = mysql_query($sql);
if( !$result ){
echo "could not query database: ".die(mysql_error());
}
$b = mysql_num_rows($result);
echo $b;
while( $a = mysql_fetch_array($result) ){
echo "Name: ";
echo $a['name'];
}
}
else{
// if a form was NOT submitted
// display the form
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="q" id="q" /><input type="submit" id="submit" />
</form>
<?php
}
?>
That is my script, and it dosen't work. I put [into the input named "q"] the exact value of one of the values, but it still outputs "0" to $b. Help!
Thanks
Tom












