/ Published in: PHP
                    
                                        
I thought this was pretty elegant code and wanted to share it with anyone who found it useful.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
$query = $search ?
( !$cat ?
"SELECT * FROM games WHERE name LIKE '%".$search."%'" :
"SELECT * FROM games WHERE category='".$cat."' AND name LIKE '%".$search."%'"
):
( $cat ?
"SELECT * FROM games WHERE category='".$cat."'" :
"SELECT * FROM games WHERE name='N/A'"
);
basic_connect($query);
URL: http://mneary.info/home/search.php
Comments
 Subscribe to comments
                    Subscribe to comments
                
                