lazarus
Mar 29th 2006, 1:52 pm
i cant seem to get the full text search to work can someone assist me. i know the last time vishwaa and a few others gave me alot of help and i was able to dolve one problem.. now im moving onto the php coding part and im have a problem with the query it keeps saying that the query failed. i didnt add the wildcard yet to search for text yet. so heres the cod.e thank you very much in advance.
<?php
$db = mysql_connect("localhost","*****","*******") or die("Problem connecting");
mysql_select_db("testDB") or die("Problem selecting database");
$query = "SELECT * FROM indexing WHERE MATCH(companyName, address, city, state, country, phoneNumber, contact1, sic, faxNumber, keyWords) AGAINST('Amery')";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
?>
<?php
echo "<TABLE BORDER=\"1\">\n";
echo "<TR bgcolor=\"lightblue\"><TD><center>COMPANY NAME</center></TD><TD>ADDRESS</TD><TD>COUNTRY</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo "<TR bgcolor=\"yellow\">\n";
} else { //if there isn't a remainder we will do the else
echo "<TR bgcolor=\"white\">\n";
}
echo "<TD>".$row['companyName']."</TD><TD>".$row['address']."</TD><TD>".$row['country']."</TD>\n";
echo "</TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
?>
is it possible because i didnt finish the table part at the bottom of the script? because i was in a hurry to test it out. im off to college now but i will keep checking . and again thanks
<?php
$db = mysql_connect("localhost","*****","*******") or die("Problem connecting");
mysql_select_db("testDB") or die("Problem selecting database");
$query = "SELECT * FROM indexing WHERE MATCH(companyName, address, city, state, country, phoneNumber, contact1, sic, faxNumber, keyWords) AGAINST('Amery')";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
?>
<?php
echo "<TABLE BORDER=\"1\">\n";
echo "<TR bgcolor=\"lightblue\"><TD><center>COMPANY NAME</center></TD><TD>ADDRESS</TD><TD>COUNTRY</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result); //get a row from our result set
if($i % 2) { //this means if there is a remainder
echo "<TR bgcolor=\"yellow\">\n";
} else { //if there isn't a remainder we will do the else
echo "<TR bgcolor=\"white\">\n";
}
echo "<TD>".$row['companyName']."</TD><TD>".$row['address']."</TD><TD>".$row['country']."</TD>\n";
echo "</TR>\n";
}
//now let's close the table and be done with it
echo "</TABLE>\n";
?>
is it possible because i didnt finish the table part at the bottom of the script? because i was in a hurry to test it out. im off to college now but i will keep checking . and again thanks