0

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

Edited by subbu_1: improved question

Attachments
---------------------------------------------------------------
     title         |     author           |    category
                   |                      |  
--------------------------------------------------------------
 
    xyz                   madman                  fiction
 
    adapt                 brainless               fiction
     
    adaxx                   stupid                fiction
 
    follow                 idiot                  journal
 
    your                    man                   acadamic
--------------------------------------------------------------
2
Contributors
2
Replies
7
Views
2 Years
Discussion Span
Last Post by subbu_1
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.