How to set a search box with ajax.

Recommended Answers

All 2 Replies

    <?php
    include("connect.php"); 
    $cat_id=$_REQUEST['cat_id'];
    $search_key=$_REQUEST['search_key'];
    if($search_key != "")
    { 
    $sql=mysql_query("select * from tbl_products where title like '%$search_key%' or short_descrp like '%search_key%' ")or die(mysql_error());
    $count=mysql_num_rows($sql);
    if($count > 0)
    {
    while($row_city=mysql_fetch_array($sql))
        {
        echo $row_city['title']."<br>";
        //echo $row_city['short_descrp'];
        }
    }
    else
    {
    echo "no result";
    }
    }
    mysql_close($con);
    ?>



    I want to fetch two column details based on search key but came only one column details .. please suggest me
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.