Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    30

    Unanswered: php/mysql queries

    Hi,

    Im really stuck when it comes to queries. I was wondering if someone could give me some basic help. I have my table called "customer_info" with name, address1, address2, address3 and a few more fields.

    I now am trying to set up a php page that will allow users to search multiple fields, and then i presume when they click search it will take them to another page which will display the results.

    Can anyone give me an example of what i need to do?

    Thanks in advance

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    its not 'that difficult' to understand

    in essence you have 2, possibly 3 scripts/sections
    the first one handles the user input, so lay out a form using text boxes
    decide where you are going to do your validation / processing (it could be the same script, it could be another script it doesn't matter. in the forms action place the url of the script that is doing the next stage.

    in that script test each element to see if it has valid input (make sure you filter out any invalid characters (which could provide an SQL injection attack or other nasty from the scum). for each element that is valid build your sql string. eg select <mycolumnlist> from <mytable> where FName like "%<myparameter>%" and CITY like "%<myparameter1>%" order by SNAME, FNAME, CITY;

    then do what ever processign on that rowset returned form MySQL

    Its worth having a bash yourself, and see where the problems are, rather than get a premade example.

    there are probably some usefull pointers on the PHP.NET site
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •