login | register
Tue 18 of Nov, 2008 (09:41 UTC)

bitweaver - Web Application Framework and CMS

Web Application Framework and CMS

Refresh cache

Is there an easy way to update data to a DB table?

by Stephan Borg
Friday 15 of July, 2005
Posted to Developer's FAQ
If you had a simple table, say:
'my_faq' => "
	faq_id I4 AUTO PRIMARY,
	question C(255) NOTNULL,
	answer C(255) NOTNULL,
",


And you wanted to update a record, you would prepare the data to update in the following array:
$my_data = array(
	'question' => "What is this project again?",
	'answer' => "Its the Bitweaver CMS and Application Framework!",
);


Next, you would define what record you plan to update. You do this by building a search array.
$my_id = array (
	"name" => "faq_id",
	"value" => 5,
);


Then to update the database:
$gBitDb->associateUpdate( 'my_faq', $my_data, $my_id );

Comments