Jump to content

lnenad

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lnenad's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So let's assume i'm making a script for searching cars by different criteria. Name of the car, color, and mileage. I used to do this by using LIKE and just adding AND for as many times as needed. But i've read that that is obsolete and is giving servers a hard time, so i went ahead and started making a new script that will use fulltext search. I've hit a dead end. function search($table,$what,$string,$limit,$start,$country) { global $totrows; global $pages; $string = explode("*",$string); $what = explode("*",$what); $cname = trim($string[0]); $t = 0; $parameters = ""; while (isset($what[$t])){ if ($t>0) { $paramm .= ", "; } $paramm .= trim($what[$t]); if ($t>0) { $parama .= " "; } $parama .= trim($string[$t]); $t++; } $parameters .= " AND locationc = '".$country."'"; $sql = "SELECT *, MATCH(".$paramm.") AGAINST('".$parama."') AS score FROM main WHERE MATCH(".$paramm.") AGAINST('".$parama."') ORDER BY score DESC"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { var_dump($row); } } How does this work: The user selects and enters his parameters> The script then joins them all into a single variable which is then sent to the function(the reason i do this i because the user might input only the name, so that way i can add more criteria and not need to change the script)> The script explodes those into arrays and then it processes them into a form for use with sql> I run the sql query and then return the results. What's the problem? There's two of them actually> The first one is that mysql returns an error "Can't find FULLTEXT index matching the column list" even though i did setup fulltext indexes. (phpmyadmin c/p) name FULLTEXT No No name 0 YES color FULLTEXT No No color 0 YES mileage FULLTEXT No No mileage 0 YES The second problem is that the script is not selective and will not work as intended. For example, a car's name is 300, the users input's 300, and the script will return those rows that had mileage 300 or 300000 or whatever. How do i fix this, and is FULLTEXT the right way to go with multi criteria search?
  2. lnenad

    SSL

    That's what i wanted to know, thanks, i was thinking that special code is necessary when using SSL. Cheers
  3. lnenad

    SSL

    Yes but how is it used, how do i use SSL with my scripts, will just by adding httpS (and if the server supports it) all of the inf be encrypted ?
  4. lnenad

    SSL

    It that time in a boy's life to learn new things to keep up with the latest trends. Now i've been doing google researching but i simply don't get it. How do you use SSL, how do i interact with the user using SSL, all i know is when it's https it's secure but what about if the user tries to access the script with http? I've got Xampp for local testing and open_ssl, on their website nothing can be found (it's as old as php ). Any help would be appreciated
  5. Nice, works like a charm ! My logic is faulty Thanks a lot mate
  6. I need OR . $res is a mysql return array ['cat'] is a column. It represents some categories, 5 of them, and some (3) have additional info to be displayed, 2 of them don't so i don't want to display that additional information when the categories selected aren't those 3. If it's NOT EQUAL 4 OR 5 display the info, otherwise don't display it, hence the IF ($res['cat']!="Nothing" || $res['cat']!="Something"){ do some code }
  7. ($res['cat']!="Nothing" || $res['cat']!="Something"){ do some code } That for some reason is not working and the code gets executed even though $res['cat']!="Something" . When i try the conditions separately it doesn't. I don't understand what's wrong ?
  8. Thank you so much
  9. How to generate an inverse color based on a hex color code ?
×
×
  • 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.