
Quote from smartmedia on July 31, 2023, 9:02 amHi..
I run this query but i don't know where to look for the results.
$sqlAlias[30]="SelectCountServices"; $sqlQuerys[30]="SELECT (SELECT COUNT(*) FROM Services WHERE status = 'active') AS Active_Ads_Count, (SELECT COUNT(*) FROM Services WHERE status = 'progress') AS In_Progress_Ads, (SELECT COUNT(*) FROM Services WHERE status = 'com') AS Contact_Info_Requested_Ads, (SELECT COUNT(*) FROM Services WHERE status = 'finished') AS Completed_Ads"; $sqlMaxUserLevel[30]=-1;I nvoke the query from this line
neoPhpExecSql "servicefinder" "SelectCountServices" "" "CountServices"What i should put in Countservices subroutine in order to read all the variables ?
Hi..
I run this query but i don't know where to look for the results.
$sqlAlias[30]="SelectCountServices"; $sqlQuerys[30]="SELECT (SELECT COUNT(*) FROM Services WHERE status = 'active') AS Active_Ads_Count, (SELECT COUNT(*) FROM Services WHERE status = 'progress') AS In_Progress_Ads, (SELECT COUNT(*) FROM Services WHERE status = 'com') AS Contact_Info_Requested_Ads, (SELECT COUNT(*) FROM Services WHERE status = 'finished') AS Completed_Ads"; $sqlMaxUserLevel[30]=-1;
I nvoke the query from this line
neoPhpExecSql "servicefinder" "SelectCountServices" "" "CountServices"
What i should put in Countservices subroutine in order to read all the variables ?

Quote from luishp on July 31, 2023, 7:27 pm@smartmedia when in doubt use ConsoleLog to print the data you get from the server in the Console.
Examining the coming data is usually very easy to see if it's a single number, string or an Array.
Let me know if you need additional information.Regards.
@smartmedia when in doubt use ConsoleLog to print the data you get from the server in the Console.
Examining the coming data is usually very easy to see if it's a single number, string or an Array.
Let me know if you need additional information.
Regards.

Quote from smartmedia on August 1, 2023, 10:11 amHi @luishp
When i run it locally using the [CountServices] i don't receive any error or message with ConsoleLog.
When i test it on server i get a n error. It shown on the photo ?
Hi @luishp
When i run it locally using the [CountServices] i don't receive any error or message with ConsoleLog.
When i test it on server i get a n error. It shown on the photo ?
Uploaded files:
Quote from luishp on August 1, 2023, 10:54 am@smartmedia I have not enough information to help you.
Does the callback subroutine execute at all? (you can add a jsAlert to be sure)
If the subroutine is executed then any kind of data must be received from the server.
If the subroutine is not executed then please double check database name alias, query alias and subroutine name.
Any other query is executed correctly?Regards.
@smartmedia I have not enough information to help you.
Does the callback subroutine execute at all? (you can add a jsAlert to be sure)
If the subroutine is executed then any kind of data must be received from the server.
If the subroutine is not executed then please double check database name alias, query alias and subroutine name.
Any other query is executed correctly?
Regards.

Quote from smartmedia on August 1, 2023, 9:01 pmHi @luishp
After some tests i made i discover that if the query has hardcore values inside the config.php and the neoPhpExecSql hasn't any parameters the query will NOT executed.
Second observation is that, if the query has (SELECT COUNT(*) FROM Services WHERE status = 'active') AS Active_Ads_Count
the AS Active_Ads_Count wil NOT run the query.
And third observation is that finally i get some result only if i have parameters in neoPhpExecSql and only if the AS Active_Ads_Count is deleted from the query. The other thing is that for some reason all the query is the first part of the string, check the photo. So from where i will get the values ?
Count (*) is a must function and i want to have it. Any ideas ?
Hi @luishp
After some tests i made i discover that if the query has hardcore values inside the config.php and the neoPhpExecSql hasn't any parameters the query will NOT executed.
Second observation is that, if the query has (SELECT COUNT(*) FROM Services WHERE status = 'active') AS Active_Ads_Count
the AS Active_Ads_Count wil NOT run the query.
And third observation is that finally i get some result only if i have parameters in neoPhpExecSql and only if the AS Active_Ads_Count is deleted from the query. The other thing is that for some reason all the query is the first part of the string, check the photo. So from where i will get the values ?
Count (*) is a must function and i want to have it. Any ideas ?
Uploaded files:

Quote from Phil78 on August 7, 2023, 6:32 pmHi @smartmedia
Here is an example with select count, hope this help you
config.php :
$sqlAlias[27]="countT2";
$sqlQuerys[27]="SELECT count(J2G) as nbJ, 2 as nT FROM mt_tour2 WHERE ID = ?";
$sqlMaxUserLevel[27]=-1;Calling count :
neoPhpExecSql "dbMT" "countT2" "[nID]" "TirageEffectue"
subroutine TirageEffectue (parameter [resp] type string ) :
CreateEmptyObject [MyT]
SetVar [MyT] [resp]
If [MyT(0).nbJ] > 0
SetVar [nTour] [MyT(0).nT]
Setvar [Select] "selectT[nTour]"
SetVar [aTirage([nTour])] true
If [nTour] == 2
neoPhpExecSql "dbMT" "[Select]" "[nID]" "LoadT2"
Hi @smartmedia
Here is an example with select count, hope this help you
config.php :
$sqlAlias[27]="countT2";
$sqlQuerys[27]="SELECT count(J2G) as nbJ, 2 as nT FROM mt_tour2 WHERE ID = ?";
$sqlMaxUserLevel[27]=-1;
Calling count :
neoPhpExecSql "dbMT" "countT2" "[nID]" "TirageEffectue"
subroutine TirageEffectue (parameter [resp] type string ) :
CreateEmptyObject [MyT]
SetVar [MyT] [resp]
If [MyT(0).nbJ] > 0
SetVar [nTour] [MyT(0).nT]
Setvar [Select] "selectT[nTour]"
SetVar [aTirage([nTour])] true
If [nTour] == 2
neoPhpExecSql "dbMT" "[Select]" "[nID]" "LoadT2"

Quote from smartmedia on August 10, 2023, 8:31 amHi @phil78
I didint had the time to check it out cause i am in involved in some other part of the code. As soon as i check it i let you know, thanks.
Hi @phil78
I didint had the time to check it out cause i am in involved in some other part of the code. As soon as i check it i let you know, thanks.