if query passed in search box by selecting the category as fiction or whatever it may be, it should search in both title and author, if value got in title then no need to search in author, if not need to search in author,

    $search = $_POST['searchvalue']; //assume search value as xyz
    $name = $_POST['name'];// assume category as fiction

 $construct = "SELECT * FROM books WHERE category = $name  AND (title LIKE '%$search%' or author LIKE '%$search%')";
     $run = mysql_query($construct);
     $foundnum = mysql_num_rows($run);// I am getting error here

please anyone help me
database table is given below

Recommended Answers

All 2 Replies

Thank you very much it worked...

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.