Joshua's Thoughts

quickbase php api examples

Tags: , , , , ,

i’ve had a few requests for examples of how to use the quickbase php api wrapper. so here goes:

setup the quickbase object with login info

include the library and setup the object by passing in username, password, true/false (xml/http), and dbID of the db/table you’ll be transacting with.

include_once('../includes/qb.php');
$quickbase = new QuickBase('username','password', true, 'dbID');

do a quickbase query

here, we setup a query to return field 3 where (field id 15 is equal to somevalue).

$queries = array(
			array(
				'fid'	=> '15',
				'ev'	=> 'ex',
				'cri'	=> 'somevalue')
			 );

$results = $quickbase->do_query($queries, '', '', '3');

adding a record to a quickbase

this one is super easy. create an associative array with field id’s and values and then use the add_record method.

$fields = array(
			array(
				'fid'	=> '1',
				'value'	=> 'some value'),
			array(
				'fid'	=> '2',
				'value'	=> 'some value'),
			array(
				'fid'	=> '3',
'value'=>'some value')
						  );
$quickbase->add_record($fields);

edit a quickbase record

almost identical to add_record, setup the array and use the add_record method.

$fields = array(
			array(
				'fid'	=> '1',
				'value'	=> 'some value'),
			array(
				'fid'	=> '2',
				'value'	=> 'some value'),
			array(
				'fid'	=> '3',
'value'=>'some value')
						  );
$quickbase->edit_record($fields);

do a quickbase query

here, we setup a query to return field 3 where (field id 15 is equal to somevalue).

$queries = array(
			array(
				'fid'	=> '15',
				'ev'	=> 'ex',
				'cri'	=> 'somevalue')
			 );

$results = $quickbase->do_query($queries, '', '', '5');