Jump to content

valleydr

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

valleydr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have this little snippet of code: [code] <?php $referrer = $_SERVER['HTTP_REFERER'];           if($referrer == "http://www.mysite.com/search/compare.php"){         echo "<form name=\"compForm\" method=\"POST\" action=\"compare.php\"><input type=\"submit\" name=\"Submit\" value=\"View Favorites\" style=\"font-size:11px; font-family:Arial, Helvetica, sans-serif; color:#000000; border-width:0px; background-color:#FFFFFF; border-color:#FFFFFF\" /></form>";         }else{         echo "<a href=\"javascript:history.back();\" style=\"color:#000000; text-decoration:none\"> Back to Results</a>";} ?> [/code] So if I click on a link from compare.php to the page holding this code, the form button should show up instead of the java Back button. It worked fine yesterday, but suddenly it only shows the java button, and not the form button when coming from compare.php. Can anyone see this problem?
  2. Hello Barand, I tried that, but it stopped my other search functions from working properly. Below is my full search code I have. You can see what search info I am gathering, and how I am searching the db. I tried what you mention, and it worked great for the keywords field, but none of my other search fields worked properly. [code] if(!isset($HTTP_GET_VARS["model"]))     $model = ""; else     $model = $HTTP_GET_VARS["model"];      if(!isset($HTTP_GET_VARS["min_price"]))     $min_price = ""; else     $min_price = $HTTP_GET_VARS["min_price"];      if(!isset($HTTP_GET_VARS["max_price"]))     $max_price = ""; else     $max_price = $HTTP_GET_VARS["max_price"];      if(!isset($HTTP_GET_VARS["min_year"]))     $min_year = ""; else     $min_year = $HTTP_GET_VARS["min_year"];      if(!isset($HTTP_GET_VARS["max_year"]))     $max_year = ""; else     $max_year = $HTTP_GET_VARS["max_year"]; if(!isset($HTTP_GET_VARS["type"]))     $type = ""; else     $type = $HTTP_GET_VARS["type"]; $filterType = "AND (c.type LIKE '%$type%' OR '$type'='')"; if(!isset($HTTP_GET_VARS["keyword"]))     $keyword = ""; else     $keyword = $HTTP_GET_VARS["keyword"];      if(!isset($HTTP_GET_VARS["engine"]))     $engine = ""; else     $engine = $HTTP_GET_VARS["engine"];      if(!isset($HTTP_GET_VARS["drive"]))     $drive = ""; else     $drive = $HTTP_GET_VARS["drive"]; $filterKeyword = "AND (c.features LIKE '%$keyword%' OR '$keyword'='')                   AND (c.drive LIKE '%$drive%' OR '$drive'='')                   AND (c.engine LIKE '%$engine%' OR '$engine'='')                   "; if(!isset($HTTP_GET_VARS["year"]))     $year = ""; else     $year = $HTTP_GET_VARS["year"]; $sqlCnt = "SELECT COUNT(c.id)            FROM ".$db_prefix."cars AS c            INNER JOIN ".$db_prefix."dealers AS d ON d.id=c.member_id            WHERE              d.status='Active' AND            (c.model LIKE '$model%' OR '$model'='')            AND (c.price >= '$min_price' OR '$min_price'='')            AND (c.price <= '$max_price' OR '$max_price'='')            ".$filterType."            ".$filterKeyword."            AND (c.year >= '$min_year' OR '$min_year'='')            AND (c.year <= '$max_year' OR '$max_year'='')            AND (c.member_id='$dealer_id' OR '$dealer_id'='')"; [/code]
  3. I am using mySQL. There isn't any way to just somehow do smething like: [code] AND (c.features, c.engine, c.drive LIKE '%$keyword%' OR '$keyword'='') [/code] or something like that? (I realize the above is incorrect.) This would just be much easier for to update the pages. Thanks for the input.
  4. Hello. I am somewhat familiar with php, I am learning more as I go. I have come up with an issue I can't figure out. I am setting up a script that uses a search form that searches a mysql db for the keyword and show the results. I have it set up to search a specific field in the db, but I want it to search more than one. what I have so far is: [code] if(!isset($HTTP_GET_VARS["keyword"]))     $keyword = ""; else     $keyword = $HTTP_GET_VARS["keyword"]; $filterKeyword = "AND (c.features LIKE '%$keyword%' OR '$keyword'='')"; [/code] keyword is the text box from the form, and c.features is the field it is currently searching from the c table. This works, but what I need is for it to basically search c.features and c.engine and c.drive, etc. For whatever reason, i cannot figure out the correct formatting for this. I'd appreciate any help I can get. Thanks.
×
×
  • 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.