how to run a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GuruCool12221
    New Member
    • Jun 2017
    • 15

    #1

    how to run a query

    I want to edit/update some records from my database. To run a SELECT query, I have a button name=updat_it. When it is clicked, a form pops out. In that form's input boxes I want to display respective values from the database, for eg. for input box Name, I want to display 'Ram' which is retrieved from the database.
    How can I run query like this?
  • GazMathias
    Recognized Expert New Member
    • Oct 2008
    • 228

    #2
    There isn't nearly enough information here to let us help you in any meaningful way.

    However,

    You could write a javascript function to call a page via AJAX that selects the data from the database, encodes the data as JSON and echos it out.

    In the javascript function's callback parse the JSON and write the results to the inputs.

    Alternatively,

    Write the PHP page so that it generates the form in its entirety and insert the returned form to the element that 'pops out' in the callback.

    I assume you know how to select records from your database and work with the results in PHP and that you have some javascript awareness.

    For the rest I suggest you look at the basics of AJAX and JSON. Searching for AJAX tutorial or JSON tutorial on Google would be a good start.


    Gaz

    Comment

    Working...