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"; ?> PHP: 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
$result = mysql_query($query) or die ("Query failed"); replace the above line with the code below and post the error message I believe it would be the same "Can't find FULLTEXT index matching the column list" error.
Error: Unknown column 'contact1' in 'where clause' i got the above error but when i try a select query to shoq all the fields it works soon as i change to this type of query like the where match it gives the above error.
<?php $db = mysql_connect("localhost","****","*****") or die("Problem connecting"); mysql_select_db("contacts") or die("Problem selecting database"); $query = "SELECT * FROM contacts WHERE MATCH(companyName, address, city, state, country, phoneNumber, contact1, sic, faxNumber, keyWords) AGAINST('Amery')"; $result = mysql_query($query,$db) or die("Error: ".mysql_error()); //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>CITY</TD><TD>STATE</TD><TD>COUNTRY</TD><TD>PHONE NUMBER</TD><TD>CONTACT</TD><TD>SIC</TD><TD>FAX NUMBER</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['city']."</TD><TD>".$row['state']."</TD><TD>".$row['country']."</TD><TD>".$row['phoneNumber']."</TD><TD>".$row['contact1']."</TD><TD>".$row['sic']."</TD><TD>".$row['faxNumber']."</TD>\n"; echo "</TR>\n"; } //now let's close the table and be done with it echo "</TABLE>\n"; ?> PHP: can someone suggest how i can convert this into like a text search for a website like where i put in some text and it will search for that string.
ok after alot of searching and manipulation of my own code. i was lazy to write it but i finally got around to writing it. i got the stuff. thanks everyone. thanks tops will look into that too.