Last active
January 16, 2022 02:52
-
-
Save dcblogdev/5679793 to your computer and use it in GitHub Desktop.
filter search example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_GET['submit'])){ | |
extract($_POST); | |
if(!empty($subject)){ $extra.= " AND subject = '$subject'"; } | |
if(!empty($id)){ $extra.= " AND id = '$id'"; } | |
if(!empty($FirstName)){ $extra.= " AND FirstName = '$FirstName'"; } | |
if(!empty($LastName)){ $extra.= " AND LastName = '$LastName'"; } | |
if(!empty($address)){ $extra.= " AND address = '$address'"; } | |
$q = mysql_query("SELECT * FROM table WHERE id $extra"); | |
$r = while($row = mysql_fetch_object($q)){ | |
//display result here like: | |
echo $row->subject; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment