Jump to content

tontox5

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tontox5's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Figured it out. Its the ft_min_word_len in mysql variables. I edited the my.cnf file in /etc/ and added the line set-variable = ft_min_word_len=2 Saved, make sure the permissions are not root only read Then stopped and restarted the mysql database with these commands # /etc/init.d/mysqld stop # /etc/init.d/mysqld start Then ran the command...REPAIR TABLE tbl_name QUICK; to reset the indexes. After that two and three letter strings were indexed perfectly.
  2. I figured out how to use Multiple words but I am getting a results blackhole for some terms. One of the headlines is Ducati 848 in Pearl White (Year: 2007) The fulltext search will find Ducati Pearl White Ducati White Ducati 2007 2007 But NOT anything with 848. Also, another headline is 2006 Yamaha R1 The search will work with 2006 2006 Yamaha But not R1 I don't get it... Here's my code. $boolean_query = "('"; for($n=0;$n < $word_count;$n++){ $boolean_query .= '+'.$search_words[$n].'* '; } $boolean_query .= "' IN BOOLEAN MODE)"; $sql="SELECT * FROM listings WHERE MATCH (headline) AGAINST" . $boolean_query . "ORDER BY listing_id DESC LIMIT $start_here,10"; Anyone have any ideas?
  3. Hey Rhodesa, the first code you gave me works great. I didn't know you could append to the $boolean_query variable by adding a period before the equal sign. Learn something new every day, A grateful beginner, Nick
  4. This is part of a mysql query, and I just can't figure out how to make it scaleable. Anyone got ideas? if ($word_count==1) $boolean_query = "('+$search_words[0]*' IN BOOLEAN MODE)"; if ($word_count==2) $boolean_query = "('+$search_words[0]* +$search_words[1]*' IN BOOLEAN MODE)"; if ($word_count==3) $boolean_query = "('+$search_words[0]* +$search_words[1]* +$search_words[2]*' IN BOOLEAN MODE)"; if ($word_count==4) $boolean_query = "('+$search_words[0]* +$search_words[1]* +$search_words[2]* +$search_words[3]*' IN BOOLEAN MODE)"; if ($word_count==5) $boolean_query = "('+$search_words[0]* +$search_words[1]* +$search_words[2]* +$search_words[3]* +$search_words[4]*' IN BOOLEAN MODE)";
  5. Hello guys, Here is my code for searching my database, however it only returns the first word in the search box, and ignores the second. Could you help me modify my query so it will return results with BOTH words? if (isset ($_REQUEST['search'])) { $search=$_REQUEST['search']; $sql="SELECT * FROM listings WHERE MATCH (headline) AGAINST ('%$search%') ORDER BY listing_id DESC LIMIT $start_here,10"; $sql2="SELECT * FROM listings WHERE MATCH (headline) AGAINST ('%$search%') ORDER BY listing_id DESC"; } Thanks! Nick
  6. Thank you Barand, your baaSelect example was exactly what I needed. It's much simpler than the first link. Now that it works, I just need to analyze it until I understand it fully or my brain explodes, whichever comes first. Thanks for your help, solved.
  7. No offense to the writer, the concept looks good and there are 50,000 views, but the example is very hard to understand. The writer says it all works as one file, but then says "you can replace with" and then finally says "try this first" for just the bottom snippet of code. I copied and pasted the code, and I am getting the following error It is being caused by the following code, line 26 being if (!mysql_query("SELECT * FROM table WHERE ID=$P")) $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("first_test",$dbh) if (!mysql_query("SELECT * FROM table WHERE ID=$P")) { echo "Database is down"; } while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $NewData .= "<option value='".$row['ID']."'>".$row['Name']."</option>\n"; } mysql_close($dbh); Any ideas?
  8. Hello lads, I'm new here and was hoping I could get some help with a hurdle I ran into. I'm making a motorcycle classified site and have all of my makes and models stored in a mysql database. What I want to do is have the Models load after Make is selected without having to submit a form. Do I need to use javascript? Here is my code: <form name="form1" method="post" action="test-manufacturers.php"><?php mysql_connect('localhost','***','***'); mysql_select_db('database'); if (isset($_REQUEST['make'])) $make=$_REQUEST['make']; $result= mysql_list_fields ('database','manufacturers'); $max=mysql_num_fields($result); //start of the drop down menu echo "<select name='make'>"; $farray=Array(); $i=0; for ($x=0; $x < $max; $x++) { if ($make==mysql_field_name($result, $x)) { $farray[$i++]="<option value='". mysql_field_name($result, $x)."' selected>". mysql_field_name($result, $x). "</option >"; } else { $farray[$i++]="<option value='". mysql_field_name($result, $x)."'>". mysql_field_name($result, $x). "</option>"; } } sort($farray); foreach($farray as $f){ echo $f; } echo "</select><br/><br/>"; // end of the drop down menu if (isset($make)) { echo "<select name='model'>"; $sql="SELECT * FROM manufacturers WHERE $make !=''"; $result= mysql_query($sql); $farray=Array(); while ($row = mysql_fetch_array($result)) { $farray[$i++]="<option value='". $row[$make]."'>". $row[$make]. "</option>"; } sort ($farray); foreach($farray as $f){ echo $f; } echo "<option value='Other'>Other</option>"; echo "</select><br/><br/>"; } ?> <input type="submit" name="submit" id="submit" value="List"> </form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.