add record to appgini database with url

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
tundra96
Posts: 2
Joined: 2013-05-10 17:16

add record to appgini database with url

Post by tundra96 » 2013-05-10 17:22

what is the format to add a record into a appgini application just using a url ?

like:

Code: Select all

http://www.myapp.com/raw_numbers_view.php?SelectedID=9&record-added-ok=691309475&SortField=&SortDirection=&FirstRecord=1&DisplayRecords=all
I want to know what the string would be to add a record, without using the appgini application interface

tundra96
Posts: 2
Joined: 2013-05-10 17:16

Re: add record to appgini database with url

Post by tundra96 » 2013-05-10 21:51

Does anyone know what the format would be to add a record ? I have another application that needs to be able to insert data into the database just using a url ... not the appgini form

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: add record to appgini database with url

Post by KSan » 2013-05-11 03:18

Not enough info provided. What is your other application? What platform? VB on PC, PHP on browser, C++ etc ? How can one answer an incomplete question such as yours.

Also please be patient. Don't double post after 4 hours just because no one replied... This forum is mostly supported by AppGini users just like you so some patience and courtesy goes a long way. Have a great weekend.

User avatar
a.gneady
Site Admin
Posts: 1354
Joined: 2012-09-27 14:46
Contact:

Re: add record to appgini database with url

Post by a.gneady » 2013-05-11 13:38

Tundra, you can't insert a record directly from the URL (that is, using GET request) ... you must use POST to insert a record ... Your other application should compose a POST request (using curl or some other method) .. The POST request should post to "tablename_view.php" (where tablename is the name of the concerned table), and contain a variable named insert_x with value set to 1 and a variable named after each editable table field, with its value set to whatever is to be inserted in that field.

If your AppGini app doesn't allow anonymous users to add new records, then your other app must authenticate first and send the correct session cookie name and value to the AppGini app. A helpful tool to reverse-engineer this process is Firebug add-on for Firefox (under the Net > HTML tab)
:idea: AppGini plugins to add more power to your apps:

User avatar
Goundski
Posts: 6
Joined: 2016-02-24 11:25
Location: South Africa
Contact:

Re: add record to appgini database with url

Post by Goundski » 2016-03-11 13:55

Hi

Like this?

<?php
$data = array(insert_x=1, "name"=>"Test Product", "description"=>"test", "altname"="TP");
$string = http_build_query($data);
$ch = curl_init("http://Mydomain.com/sahdb/tblProduct_view.php")
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
?>

It did not work for me
The more we struggle for life (as pleasure), the more we are actually killing what we love.

User avatar
Goundski
Posts: 6
Joined: 2016-02-24 11:25
Location: South Africa
Contact:

Re: add record to appgini database with url

Post by Goundski » 2016-03-11 14:17

I also tried it this way with no luck?

<?php
insert_x = 1
Name = "Test Product"
Description = "test"
AltName="TP"
$ch = curl_init("http://Mydomain.com/sahdb/tblProduct_view.php")
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);

?>
The more we struggle for life (as pleasure), the more we are actually killing what we love.

User avatar
Goundski
Posts: 6
Joined: 2016-02-24 11:25
Location: South Africa
Contact:

Re: add record to appgini database with url

Post by Goundski » 2016-03-15 13:13

Okay, I found this alternative way of doing this, that worked just fine for me.
More info at: https://www.youtube.com/watch?v=fvH865tKOLE

Enjoy!
The more we struggle for life (as pleasure), the more we are actually killing what we love.

Post Reply