// $db->auto_slashes = false; // You cannot perform any MySQL functions when using insert_array() as the the // function will be enclosed in quotes and not executed. If you have some fancy // MySQL functions you'll want to use the insert_sql() function in which you // provide all the sql. // Also, it's worth pointing out that if the table in which data is being inserted // has an auto_increment value (as this one does), then the function will return // that value which is generated. echo "<br>Adding data to the table from an array...<br>"; $data = array('user_name' => 'Micah Carrick', 'email' => '*****@*****.**', 'date_added' => '04/13/2003 4:12 PM', 'age' => 24, 'random_text' => "This ain't no regular text. It's got some \"quotes\" and what not!"); $user_id = $db->insert_array('users', $data); if (!$user_id) { $db->print_last_error(false); } $db->print_last_query(); $db->dump_query("SELECT * FROM users WHERE user_id={$user_id}"); // This is similar to the above, only it updates the data rather than insert. Also // you'll notice that in the first one we used a string to represent the date // and this time we're using the time function to generate a timestamp. This is // done to illustrate the class' ability to convert the date and time formats // to a MySQL compatible format. I like that alot :) echo "<br>Updating the data in the table by changing the date_added... "; $data = array('date_added' => time()); $rows = $db->update_array('users', $data, "user_id={$user_id}"); if (!$rows) { $db->print_last_error(false); } if ($rows > 0) { echo "{$rows} rows updated."; } $db->print_last_query();