Sunday, May 6, 2012

Inserting Into Data in WordPress database

To perform an insert, we can use the insert method: 
 $wpdb->$wpdb->insert( $table, $data, $format ); ?> 
 Insert a row into a table.
$wpdb->insert(
'rz_tblsubmit',
array(
'id' => '',
'titleofevent' => $_POST["title"],
'typeofevent' => $_POST["type"],
'organisation' => $_POST["organisation"],
'website' => $_POST["website"],
'description' => $_POST["description"],
'startdate' => $_POST["start_date"]."-".$_POST["start_time"],
'enddate' => $_POST["end_date"],
'entryprice' => $_POST["entry_price"],
'venueaddress' => $_POST["venue_address"],
'venuecountry' => $_POST["venue_country"],
'postcode' => $_POST["venue_postcode"],
'venuewebsite' => $_POST["venue_website"],
'contact' => $_POST["contact"],
'contactemail' => $_POST["contact_email"],
'contactphone' => $_POST["contact_phone"],
'wessage' => $_POST["message"],

),
array(
'',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%d',
'%s',
'%s',
'%s',
'%d',
'%s'

)
); ?>

No comments:

Post a Comment