Search Database from URL

I am sorry if this has been asked before but I am new to this and stuck.

Users get prompted to select two options from dropdown menus (type and county).

THe search page is: http://www.yourcoupontv.com/search.html

The results get added to the url after the ? for example:

http://www.yourcoupontv.com/couponlist.php?type=Restaurant&county=Hillsborough

I am trying to display the list of records that match those two fields.

Here is the code to display the results.

  **$type=$_GET["type"];**

** $county=$_GET[“county”];**
** echo $type;**
** echo $county;**
** // SQL query**
** $strSQL = “SELECT * FROM coupons where type = '” .$type. “’ AND county= '” .$county. “’”;**
** // Execute the query (the recordset $rs contains the result)**
** $rs = mysql_query($strSQL);**

Can anyone help? I know you might need more info…

You are using dangerous, obsolete code that has been completetly removed from Php. You need to use PDO with Prepared Statements. Here is a tutorial to get you going.

https://phpdelusions.net/pdo

Sponsor our Newsletter | Privacy Policy | Terms of Service