423,682 Members | 1,649 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,682 IT Pros & Developers. It's quick & easy.

how to run a query

P: 12
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?
Jan 8 '18 #1
Share this Question
Share on Google+
1 Reply


GazMathias
Expert 100+
P: 189
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
Jan 8 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.