[SOLVED] Rest API Stored procedure with IN parameters |
6/27/2022 5:58:05 PM |
PHPRunner General questions | |
Davor Geci authorDevClub member
Hello, After following the great video https://www.youtube.com/watch?v=MHr67SWh8xU I was able to create the SP, create the custom SQL View and in Running the SQL I get asked for the parameters and when putting them in I get the result back. I think that I'm doing something wrong in the Custom SQL View. I have only the list view with this: CALL sp_recordpunch(':{dtpunchdatetime}', :{varcarduid}, ':{vardeviceid}', :{intstatusid}); The url is: MYWEBPAGE//api/v1.php?apikey=MYAPIKEY&table=sp_recordpunch&action=list&dtpunchdatetime=2022-02-24T17:15:11&varcarduid=2222&vardeviceid=1&intstatusid=1 The response is: {"data":[{"varcarduid":"0","fullname":null,"varerror":"NO RECORDS"}],"success":true} I have returned the varcarduid so that I can see what is the parameter value inside the stored procedure. As you can see in url is 2222 and from the results from the SP it is 0 And here is the code for the MySQL SP:
|
|
Sergey Kornilov 6/27/2022 | |
If you want to use the URL parameters in your SQL , use this syntax:
|
C
|
Craig Smith 6/29/2022 |
Brilliant !!! - this is exactly what I was looking for today. Thanks for the question and response. |