
PHP
Get flash to fully experience Pearltrees
// insert a new record using insert() $data [ 'news_id' ] = 47 ; $data [ 'title' ] = "You're Top" ; // insert() will auto escape it for us $data [ 'created' ] = "NOW()" ; // it knows to convert NULL and NOW() from a string // insert() parameters // table name (ideally defined as a constant, but did not for this example) // assoc array with data (does not need escaped) // insert() returns // primary id of the inserted record. you can collect or ignore $primary_id = $db -> insert ( "news" , $data ); // then use the returned ID if you want echo "New record inserted: $primary_id" ; // would create the query: // INSERT INTO `news` (`news_id`,`title`,`created`) // VALUES ('47', 'Your\'re Top', NOW())

