Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $output= '';
- if(isset($_POST['search_but'])){
- $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
- if (!$dbc){
- echo "i'm sorry we are experiencing technical issues<br />
- please try again soon<br />";
- }//end of if(!dbc)
- else{
- $search_term = $_POST['search'];
- //query
- $query ="SELECT Product_Name, Price, RRP_Price, Description, Image_ID
- FROM products
- WHERE Product_Name LIKE '%$search_term%'
- " ;
- $products = mysqli_query($dbc, $query);
- $count = mysqli_num_rows($products);
- if($count == 0){
- $output = 'there was no search results';
- }//end of if($count==0)
- else{
- while($row = mysqli_fetch_array($products));{
- $Product_Name = cleaner($row['Product_Name']);
- $Price = cleaner($row['Price']);
- $RRP_Price = cleaner($row['RRP_price']);
- $Description = cleaner($row['Description']);
- $output .= '<div>'.$Product_Name.' '.$Price.'</div>';
- }//end of while
- }//end of if($count==0)else
- }//end of if(!dbc) else
- }//end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement