WordPress database error after fresh install
-
I just downloaded and activated your version 1.0.0.
I added the shortcode
[ewz_show_webform identifier="pair"]
to a page and tried to upload a new image. When I clicked the Submit button I got a dialog box that said (in part) “WordPress database error [Field last_change doesn’t have a default value]” and “Sorry, there was a problem creating the item …”I made a change to the
save()
function in ewz-item.php that avoids the error:} else { // $data['upload_date'] = current_time( 'mysql' ); // array_push( $datatypes, '%s' ); $data['last_change'] = $data['upload_date'] = current_time( 'mysql' ); array_push( $datatypes, '%s' ); array_push( $datatypes, '%s' ); $wpdb->insert( EWZ_ITEM_TABLE, $data, $datatypes ); $inserted = $wpdb->insert_id; if ( !$inserted ) { foreach( $this->item_files as $item_file ){ $errors .= $this->delete_file( $item_file ); } throw new EWZ_Exception( 'Sorry, there was a problem creating the item '. basename( $item_file['fname'] ) . ", please refresh the page to see your current status.\n", $errors ); } }
As you can see, I commented out two original lines and added some code to supply a value for ‘last_change’.
I also had a problem with the “Example Competition Form”. I selected “Digital”, supplied a title and clicked “Submit”. I got a dialog box that said “Sorry, there was an error in row 1: A Digital type must have an Image File.” There is no visible field on the form where I can supply an image file.
- The topic ‘WordPress database error after fresh install’ is closed to new replies.