• How do I use $wpdb->insert to insert multiple rows. Here is my code.

    for($i=0; $i<=$urlCount; $i++) {
    	$stat = $wpdb->insert(
    		'WP_URLS',
    		array(
    			'POSTID' => $post->ID,
    			'URL' =>   $_POST['url'.$i]
    		)
    	);
    }

    This code works only for the first insert (ie, when $i = 1). Sometimes the URL count will be more than 100 and sometimes it will be zero. So instead of writing the code for 100 times, I just want to have a simple loop that works for any number of records. Thats the reason I went for loop.

    Thank you for the help.

  • The topic ‘$wpdb->insert – inserting multiple rows’ is closed to new replies.