Insert data into custom table from fetching $_POST values

if(!empty($_POST)) { $player_name = $_POST[‘first_name’]; $payer_email = $_POST[‘payer_email’]; $payment_gross = $_POST[‘payment_gross’]; $payment_date = $_POST[‘payment_date’]; $payer_id = $_POST[‘payer_id’]; $paypal_str = array($player_name, $payer_email, $payment_gross, $payment_date, $payer_id); print_r($paypal_str); global $wpdb; $wpdb->insert( ‘paypal’, array( ‘name’ => $paypal_str[0], ’email’ => $paypal_str[1], ‘amount’ => $paypal_str[2], ‘player_id’ => $paypal_str[3], ‘date’ => $paypal_str[4] ) ); } Remove the unwanted comma from the array.

PHP Use Declared array Variable inside already Declared Array

This is more a generic PHP question than anything to do with WordPress, but I’d suggest setting the value in the constructor: class test { public $basicCols; public $optList = array( ‘one’ => ‘One’, ‘two’ => ‘Two’ ); function __construct() { $this->basicCols = array( array( ‘title’ => ‘KEY’, ‘field’ => ‘slug’, ‘options’ => $this->optList ), … Read more

Combine two foreach Arrays into one table row

if the artist names and track names are in matching order and the same in number then: <?php $artists = get_post_custom_values(‘Artist’, $post->ID); $tracks = get_post_custom_values(‘Track’, $post->ID); $i=0; foreach ( $artists as $key => $value ) { $class = ( $i % 2 ) ? ‘alternative’ : ”; // modulus operator echo ‘<li class=”‘ . $class … Read more

SQL query add only posts with custom field to array

Why don’t you just do: <?php global $post; $args = array( ‘post_type’ => ‘post’, ‘post_status’ = ‘publish’, ‘posts_per_page’ => ’10’, ‘meta_query’ => array( array( ‘key’ => ‘fruit’, ‘value’ => ‘apple’ ) ) ); $custom_query = new WP_Query( $args ); while( $custom_query->have_posts() ): $custom_query->the_post(); ?> <?php the_title(); ?> <?php endwhile; wp_reset_query(); ?>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)