Forum: Installation

Post: Need help for VoltDB with PHP Integration

Need help for VoltDB with PHP Integration
M_A_K687
Aug 20, 2013
Hi,
I want to know how to use voltDB query using PHP script. voltDB sucessfully install on my ubuntu12.4 system (using tutorial) & i also run voter example but don't find any example how can i get voter data using query in PHP script.
jpiekos
Aug 20, 2013
Please check out the readme and samples in our PHP client github repository: https://github.com/VoltDB/voltdb-client-php/blob/native/examples/example.php shows an example of invoking Voter methods via php.
M_A_K687
Aug 20, 2013
i check this example but don't find what i looking for let say i am create my own table Helloword now i want to insert record in this table by PHP how can i achieve this goal?
nshi
Aug 20, 2013
If you have a table named Helloworld, you can call the auto-generated insert procedure to insert a row. The following PHP statements will insert a row with values (3, 4, 5) into the table and check for a response.


$resp = $voltClient->invoke("Helloworld.insert", array(3, 4, 5));
if ($resp === null) {
    echo "invoke had an error
";
} else {
    echo "invoke returned a response
";
}
M_A_K687
Aug 21, 2013
@ nshi
thanks for your help is there any tutorial for this like voltDB SELECT,INSERT, UPDATE OR Complex Query like Join one or more table query by using PHP or any other example which help me to understand which method should i call , because in voltDB Documentation i am not able to find PHP related examples
nshi
Aug 21, 2013
The PHP invoke/invokeAsync methods are generic calls that allow you to invoke any stored procedure. The PHP client is documented in the API README.

For auto-generated stored procedures, they are documented here. If you want to write more complex SQL queries, you can follow the example in this link. I highly recommend going over the chapter on designing stored procedures.