Write TextGadget text from php
Write TextGadget text from php
hello, is there an example on how write textgadget text from php code ? Thank you for the support. What I want is write mysql database with php INSERT, than get latest insert id, and write this id into a textgadget ... possible ?
Re: Write TextGadget text from php
Hi Efo,
I used JSON and HTTPRequest to do this combine php + sb.
BTW, I'm new in SB. i'll still on trial version and I started last week.
I used JSON and HTTPRequest to do this combine php + sb.
BTW, I'm new in SB. i'll still on trial version and I started last week.
Code: Select all
Procedure HttpGetEvent(Success, Result$, UserData)
Protected material_request_record.material_request_query_result
Protected record_no.i, start_time.i, process_time.i
If Success
If ParseJSON(0, Result$)
ExtractJSONStructure(JSONValue(0), @material_request_record, material_request_query_result)
FreeJSON(0)
Else
Debug JSONErrorMessage()
EndIf
ClearGadgetItems(lst_material_request_status)
record_no = 0
Protected days_left.s
ForEach material_request_record\Result()
AddGadgetItem(lst_material_request_status, record_no, material_request_record\Result()\mat_req_ID + Chr(10) + material_request_record\Result()\UserName + Chr(10) + material_request_record\Result()\installation_bldg)
record_no + 1
Else
Debug "HTTPRequest(): Error"
EndIf
EndProcedure
Procedure get_material_request_list()
Protected request.s, request_result.s, Filter, HttpRequest
Protected NewMap Header.s()
If CreateJSON(0)
Filter = SetJSONObject(JSONValue(0))
SetJSONString(AddJSONMember(Filter, "UserName"), "ALL")
SetJSONString(AddJSONMember(Filter, "AnelID"), "")
SetJSONString(AddJSONMember(Filter, "Approved"), "")
SetJSONString(AddJSONMember(Filter, "StatusType"), "")
request = ComposeJSON(0)
Debug request
FreeJSON(0)
EndIf
Header("Content-Type") = "application/json"
HTTPRequest(#PB_HTTP_Post, "get_material_list.php", request, @HttpGetEvent(), 0, Header())
EndProcedure
[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
Re: Write TextGadget text from php
Thanks for your help, now I have to study your code
Re: Write TextGadget text from php
Hi, heres my sample of screenshot to give you idea. I already reached 800lines of code so I'll be purchasing soon to explore sb.
It looks fun and easy but need some tweaking to accomplish some task.
Thanks to all who share their tips and code here in forum.
It looks fun and easy but need some tweaking to accomplish some task.
Thanks to all who share their tips and code here in forum.
[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]