WordPress.org

Ready to get started?Download WordPress

Forums

$wpdb->insert doen't work in any way (2 posts)

  1. sven85
    Member
    Posted 2 years ago #

    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.

  2. Kakoma
    Member
    Posted 1 year ago #

    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;

Topic Closed

This topic has been closed to new replies.

About this Topic