Quickstart Guide
Last modified: September 12, 2008 - 17:29
Quickstart Guide, just give me enough to get started!
Ok, install the module and put the following examples in your module somewhere so you can test it out and you are ready to roll. The following example will create a DB variable called 'tests' that is an array that has a boolean value in it and is associated with NID 4. It will then get the variable from the DB after it has saved it, and then delete it. Its pretty self explanatory.
Example Usages:
<?php
echo "<pre>";
//Create a variable of some sort to store in the database
$test['test'] = TRUE;
//Save the variable to the DB and associate it with NID 4
queryable_variables_set('tests', $test, 'nid', 4);
//Unset the variable so that we know it's completely empty
unset($test);
//Re-Load the variable from the DB
$test = queryable_variables_get('tests', 'nid', 4);
//And here we can print out what we actually got from the DB
echo "Current Value from the database:\n";
print_r($test);
//We can see the date the variable was tossed into the DB with this command
echo "This variable was last updated on: ";
echo queryable_variables_get_date('tests', 'nid', 4) . "<br>";
//We are done with the variable, so lets nuke it from the database
$id = queryable_variables_del('tests', 'nid', 4);
//Echo out the ID of the variable that was deleted from the DB incase we need to use it somewhere.
echo "Deleted Queryable Variables ID: $id";
echo "</pre>";
//Read the API documentation for a FULL list of all the available features of each of these functions as well as others I didnt list here.
?>