Jezza22 Posted April 21, 2009 Share Posted April 21, 2009 I have a php function that gets the next available document number, from a MYSQL database, which works great. I have a page, that combined with php/javascript and using an Ajax method, updates the database and increments the document number. The problem I have is refreshing the page to show incremented document number. Is it possible call the function again and it perform function again, retrieving the new values from the database, without submitting the page? I have tried lots of things with no success. I'm fairly new so please bear with me Here's the function: - function DocumentNext() { $query = "SELECT * FROM counts_file;"; $result = mysql_query($query); $nextDoc=mysql_result($result,$j,'Document'); echo $nextDoc; } I can post the remainder of the code if necessary that containts the javascript let me know? Link to comment https://forums.phpfreaks.com/topic/155071-calling-a-function-twice/ Share on other sites More sharing options...
soak Posted April 21, 2009 Share Posted April 21, 2009 You could return that value in the response to your ajax call and using javascript update the place on the page that shows this number. Link to comment https://forums.phpfreaks.com/topic/155071-calling-a-function-twice/#findComment-815636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.