how to make searching php for receive file - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to make searching php for receive file

baebae Posts: 45Member
this is the form. i want the code able to read from table in the database.






Any Field





Title 




Author


 Year









Comments

  • AgbagbaraAgbagbara Posts: 24Member
    could you be a little bit more explanative
  • baebae Posts: 45Member
    the keyword will be include title, author, year. it will invoke from database that store the source file.
  • AgbagbaraAgbagbara Posts: 24Member
    [code]









    Keyword

    Any Field
    Title 

    Author
     Year
    [/code]

    if your table is called "ALL_BOOKS", and has the following columns TITLE,AUTHOR and YEAR.
    Lets say you have a keyword textbox called "keyword", when u post the form to the processing page,
    you would have to do the following
    [code]
    $d_keyword = $_POST["keyword"];
    $check_field = $_POST["keyword"];
    d_where = array();
    switch($check_field){
    case "TITLE":
    $d_where[] = " `TITLE` like '%".$d_keyword."%' ";
    break;
    case "AUTHOR":
    $d_where[] = " `AUTHOR` like '%".$d_keyword."%' ";
    break;
    case "YEAR":
    $d_where[] = " `YEAR` like '%".$d_keyword."%' ";
    break;
    default:
    $d_where[] = " (`TITLE` like '%".$d_keyword."%' or `AUTHOR` like '%".$d_keyword."%' or `YEAR` like '%".$d_keyword."%' )";
    break;
    }
    $where_str = (count(d_where)> 0)?" where ".implode(" and ",d_where):"";
    $d_qry = sprintf("select * from ALL_BOOKS %s , %s, %s", $where_str,$limit_str,$order_str);
    [/code]

    This is just some sketchy details on how you would go about it,

    Let me know if it helps or not.
  • baebae Posts: 45Member
    $d_keyword = $_POST["keyword"];
    $check_field = $_POST["keyword"];
    d_where = array();
    switch($check_field){
    case "TITLE":
    $d_where[] = " `TITLE` like '%".$d_keyword."%' ";
    break;
    case "AUTHOR":
    $d_where[] = " `AUTHOR` like '%".$d_keyword."%' ";
    break;
    case "YEAR":
    $d_where[] = " `YEAR` like '%".$d_keyword."%' ";
    break;
    default:
    $d_where[] = " (`TITLE` like '%".$d_keyword."%' or `AUTHOR` like '%".$d_keyword."%' or `YEAR` like '%".$d_keyword."%' )";
    break;
    }
    $where_str = (count(d_where)> 0)?" where ".implode(" and ",d_where):"";
    $d_qry = sprintf("select * from ALL_BOOKS %s , %s, %s", $where_str,$limit_str,$order_str);


    how to add u didnt mention <? ?>
Sign In or Register to comment.