Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
User avatar
By H3Dott
#829888
I want to get the last row of a pmt table before dynaform with these codes:
Code: Select all
$all = executeQuery("SELECT COUNT(GOOD_CODE) FROM PMT_STOCK"); 
$code = $all + 1;
But result of $code is 1 because value of $all is [object Object].
what should I do?
------------------------------------------------------------
Also, I try these codes:
Code: Select all
$code = $all[1][COUNT(GOOD_CODE)] + 1
But did not get a result.
Last edited by H3Dott on Mon Apr 25, 2022 9:10 am, edited 1 time in total.
User avatar
By ronrich
#829895
Hello H3Dott,

The execute query will return an array object, therefore you'll get the [object object] result.


Try this:
Code: Select all
$all = executeQuery("SELECT COUNT(GOOD_CODE) AS LAST_RECORD FROM PMT_STOCK"); 
$code = $all[1]['LAST_RECORD'] + 1;

find more information about the executeQuery function here: https://wiki.processmaker.com/3.2/ProcessMaker_Functions/Database_Functions#executeQuery.28.29


I hope this helps.
User avatar
By H3Dott
#830162
ronrich wrote: Wed Apr 27, 2022 9:58 am Hello H3Dott,

The execute query will return an array object, therefore you'll get the [object object] result.


Try this:
Code: Select all
$all = executeQuery("SELECT COUNT(GOOD_CODE) AS LAST_RECORD FROM PMT_STOCK"); 
$code = $all[1]['LAST_RECORD'] + 1;

find more information about the executeQuery function here: https://wiki.processmaker.com/3.2/ProcessMaker_Functions/Database_Functions#executeQuery.28.29


I hope this helps.
:) Thank you so much

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]