Jump to content

How to create a search with multiple tables with php and mysqli


Recommended Posts

I created a database with the name 'food-order', on the search bar i can only search for files on one of the table, how can i search for all the items within the database 'food-order' not a specific table

 

<?php

 

               

 

                //sql query to get category based on search keyword

                $sql = "SELECT * FROM tl_category AND apartment_rent  WHERE title LIKE '%$search%' OR description LIKE '%$search%' OR location LIKE '%$search%'";

 

                // execute the query

                $res = mysqli_query($conn, $sql);

                // count rows

                $count = mysqli_num_rows($res);

                // check whether category is available or not

                if($count>0){

 

                    // category is available

                    while($row=mysqli_fetch_assoc($res)){

 

                        // get the details

                        $id = $row['id'];

                        $title = $row['title'];

                        $price = $row['price'];

                        $description = $row['description'];

                        $location = $row['location'];

                        $image_name = $row['image_name'];

 

                        ?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.