• I’m having some trouble inserting data in to a table that I’ve created. Is there anything wrong with this code? None of them works.

    $wpdb->query(
    			$wpdb->prepare('INSERT INTO gowestgallery
    				(main_url, thumbnail_url, title, text) values (%s, %s, %s, %s)',
    				$main_url, $thumbnail_url, $title, $text
    			)
    		);
    
    		$wpdb->insert('gowestgallery', array(
    			'main_url' => $main_url,
    			'thumbnail_url' => $thumbnail_url,
    			'title' => $title,
    			'text' => $text
    			), array( '%s', '%s', '%s', '%s', ));
    	*/
    
    		// Insert the post into the database
    		wp_insert_post(array(
    			'main_url' => $main_url,
    			'thumbnail_url' => $thumbnail_url,
    			'title' => $title,
    			'text' => $text
    		));
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Can't insert into WordPress DB’ is closed to new replies.