B4J Question send multiple inserts to php-mysql

le_toubib

Active Member
Licensed User
Longtime User
HI falks
i "Have" to connect to a php-mysql server , and i wish to send multiple inserts (multiple records) to a table at once,
each record has many fields
number of records per request can b up to 10
. what's the best practice here ??
should i send them as array in poststring (how)? in php i would supposedly have to explode the posted array and concatenate the query string ?
or should it be postmultipart(how) ?
or is there another way ?

i dont like to create the multi-query string itself in b4j and then send it .
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
hi!
what's the best practice here ??
best practice is to use JRDC2

But if you want to use PHP then use the JSON library and use POST string to insert the data.

something like:

B4X:
dim m as map
m.initialize

dim l as list 
l.initialize

for i= 0 to yourData.size -1
l.add(yourdata(i))
next

m.put("data",l)

dim js as JSONGenerator
js.initialize(m)

js.toString
 
Upvote 0
Top