can you run a query just by a button
e.g UPDATE DATABASE
when click the button have a query in it to automatically update a table in the database
I am wondering! Why not! Create a button, write the relevant query in a function to execute it.
so
button is on a php file
Query is
SELECT loan WHERE bookid =$bookid
UPDATE loan.loan 'no'
but how do i set this in the button without opening another page?
I agree, using AJAX with jquery spoiled me.
regarding the to poster`s question.
If you want to use ajax with jquery, go to
download and include in your php file
to use ajax:
http://api.jquery.com/jQuery.ajax/
download and include in your php file
I would disagree with that, I would always suggest using a CDN one, such as the one on google code (http://code.google.com/apis/ajaxlibs/documentation/#jquery)
This article sums up my reasoning for this quite well.
I would disagree with that, I would always suggest using a CDN one, such as the one on google code (http://code.google.com/apis/ajaxlibs/documentation/#jquery)
This article sums up my reasoning for this quite well.
Thanks for that. I didn't know that existed. I'll definitely take a look.
Yep, nice one Will.
But can i not just put it in a button in the php and use mysql query??
No, php is done once it leaves the server and the info is sent to the client (your browser). The user can interact with the page in 2 main ways: via javascript - the page can be changed without refresh (e.g. hiding or changing info on the page) - BUT no changes will occur on the server (db/files etc). Via page navigation (url or form submission). This is where php can do its stuff - this is where changes can be made to DB/files etc.
Ajax is a special case where a js script is run which can access a php script and change stuff on the server without the page having to be reloaded/re-accessed. It's not as simple as js trying to run a php script.
Sorry if it sounds confusing. 'Twas a heavy day yesterday!
ok i understand, i got it sorted thanks..took a while but got there :)
could you help with validation?
I have a form with the following:
enter book id : it a combo box of all book ids in the book table
Enter book name: combo box with all book names
book author: combo box with all book author
Could you tell me how as soon as the book id is selected into the form, the book name and author would authomatically appear that match that book id??
Hope im explaining this ok...If you could help it would be great! :)
This would be another AJAX routine. Get the value of the bookId selection then query the database to get the appropriate selection numbers to activate in the other boxes.
so set a query that takes the book name and book author that is entered in2 the bookid...totally confused in how i would do that??
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.