Support » Fixing WordPress » $wpdb->insert doen't work in any way

  • Hello!
    I am writing a small plugin at the moment that needs an own table. The creation of the table works fine. The user has a form he can enter data into. That data is also send successfully via POST. But when I try to insert the data into the database it’s just not working. I am already sitting here for hours and it’s really hard for me to stay calm 😉 I think we all know that feeling. So, please, could you help me, what’s wrong here? I’ve tried every possible solution I can think of, without success. The Codex also didn’t help.

    global $wpdb;
    $table_name = $wpdb->prefix . "my_data";
    $wpdb->insert($table_name, array(
            	'my_id'		=> NULL,
    		'my_day'		=> $day,
    		'my_month'	=> $month,
    		'my_abbr'	        => $abbr,
    		'my_venue'	=> $venue,
    		'my_geo'		=> $geo_one.", ".$geo_two,
    		'my_artist'   	=> $artist,
    		'my_link'		=> $link

    I also tried it with the ‘format’-array but it didn’t work. I am really clueless, any help would be really appreciated.

Viewing 1 replies (of 1 total)
  • Hi Sven,
    First try viewing the query being run to give you a better idea of what’s going on. Use:
    echo $wpdb->last_query;

Viewing 1 replies (of 1 total)
  • The topic ‘$wpdb->insert doen't work in any way’ is closed to new replies.