Executes an insert statement which requires no SQL markup and is called from the objSQL class.
See also: Inserting Multiple Rows
mixed obj_insert ( [str table[, array data ]] )
Result resource/object or false on failure.
<?php   
try  
{  
    $data = array( "product" => "balloon",  
                   "color"   => "red",  
                   "size"    => "small",  
                   "price"   => 2.50 );  
      
    $rs = $dbh->obj_insert( "mytable", $data );  
      
    if ( $dbh->obj_error() )  
        throw new Exception( $dbh->obj_error_message() );  
          
    echo $rs->obj_affected_rows();  
      
}  
catch ( Exception $e )   
{  
    //log error and/or redirect user to error page  
}   
try   
{   
    //set arguments using statement argument helper methods 
    $dbh->obj_table( "mytable" );  
    $dbh->obj_data( array( "product" => "balloon",   
                           "color"   => "red",   
                           "size"    => "small",   
                           "price"   => 2.50 ) );   
       
    $rs = $dbh->obj_insert();   
       
    if ( $dbh->obj_error() )   
        throw new Exception( $dbh->obj_error_message() );   
           
    echo $rs->obj_affected_rows();   
       
}   
catch ( Exception $e )    
{   
    //log error and/or redirect user to error page   
}    
?>  
				See also: obj_delete, obj_paging, obj_query, obj_select, obj_update
The obj_insert method allows you to easily insert multiple rows.
<?php 
try 
{ 
    $data = array( "product" => "balloon,balloon,balloon,balloon", 
                   "color"   => "red,green,blue,pink", 
                   "size"    => "small,small,small,small", 
                   "price"   => 2.50,2.50,2.50,2.50 ); 
     
    $rs = $dbh->obj_insert( "mytable", $data ); 
     
    if ( $dbh->obj_error() ) 
        throw new Exception( $dbh->obj_error_message() ); 
         
    echo $rs->obj_affected_rows(); 
     
} 
catch ( Exception $e )  
{ 
    //log error and/or redirect user to error page 
}  
try 
{ 
    //set arguments using statement argument helper methods 
    $dbh->obj_table( "mytable" );  
    $dbh->obj_data( array( "product" => array( "balloon","balloon","balloon","balloon" ),   
                           "color"   => array( "red","green","blue","pink" ),   
                           "size"    => array( "small","small","small","small" ),   
                           "price"   => array( 2.50,2.50,2.50,2.50 ) ) );  
         
    $rs = $dbh->obj_insert(); 
     
    if ( $dbh->obj_error() ) 
        throw new Exception( $dbh->obj_error_message() ); 
         
    echo $rs->obj_affected_rows(); 
     
} 
catch ( Exception $e )  
{ 
    //log error and/or redirect user to error page 
}  
?>