3 replies
ok so I have a script that produces a list of clients in a database works fine - I have added a search box in an if statement

if (isset($_GET['search'])) {
$entry = $_GET['search'];

then I query the db and search for records according to the $entry

}

issue is down here under that if statment I have the normal query that brings back all the clients so what I'm getting when I search is the searched record + all the rest if I die(); in the if statement then obviously the page is messed up.. how can I get it to just show the searched records and how do you go about clearing the search to return to the normal records
#php #question
  • Profile picture of the author KirkMcD
    Uhmmm, don't do the full query if you have a search parameter.

    "ELSE", Know it, Live it, Learn it.
    {{ DiscussionBoard.errors[6078263].message }}
  • Profile picture of the author solidsoul
    I've tried an else statement - what I was doing was as such

    if (isset($_GET['search'])) {
    excute search query
    }
    else {
    and I was placing the normal query here that fetched all the clients and spit them out
    }
    then down here running the rest of the page

    hmmm how to explain this the index.php file has java running when you click the buttons at the top it slides the screen over and shows another section of the index.php file.. so when I'm doing this else statement it's showing a section in the wrong place does that make sence...
    {{ DiscussionBoard.errors[6078514].message }}
  • Profile picture of the author Tradeout
    Can you show the rest of the code?

    ** note: make sure you cleanse the incoming data from the search input
    {{ DiscussionBoard.errors[6082239].message }}

Trending Topics