Path

ez.no / exponential / documentation / development / libraries / ez db / data storage


Data storage

Before you do a write operation to the database you must start a new transaction. This is done with the $db->begin() function. Then you need to escape the data which you want to store, this is done with the $db->escapeString() function.

 // prepare the data for database storage

 $str = $db->escapeString( "Testing escaping'\"" );

 

 // start a new transaction

 $db->begin();

 // send the SQL INSERT command to the database

 $db->query( "INSERT INTO sql_test ( name, description ) VALUES ( 'New test', '$str' )" );

 // commit the transaction

 $db->commit();

 

 // fetch the last automatically incremented value

 $rowID = $db->lastSerialID( "sql_test", "id" );

Comments

Log in or create a user account to comment.

Contents

Development

Extensions
Exponential datamodel
Exponential tuning and stability
Importing attribute data
Kernel
Libraries
    eZ xml
    eZ db
       Data retrieval
       Data storage
    eZ i18n
    eZ soap
    eZ template
    eZ webdav
Scripting
Standards
System overview
Test Suite
Using Doxygen to create API documenta...


Created

04/07/2003
10:39:59 am
by B�rd Farstad

Last updated

04/07/2003
10:39:59 am
by B�rd Farstad

Authors

B�rd Farstad



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.