• Trying to figure out if this is a WP specific quirk.

    My var_dump‘s show the correct string to be inserted in query but the last query dump at the end shows an incomplete query with no variable being passed.

    So I’m not sure if this is a WP specific quirk or what could be the issue here? Does anyone have any knowledge on this?

    Again the dumps show the correct string until I get to to the query string on the next few lines.

    $numItems = count($changeorderVar);
    		$i = 0;
    
    		foreach ($changeorderVar as $changeorderVartwo ){
    
    			  if(++$i === $numItems) {
    				$changeorderVarstringFinal .= "'orderfeatured' => ".$changeorderVartwo .'';
    			  }
    			else
    				$changeorderVarstringFinal .= "'orderfeatured' => ".$changeorderVartwo .','; 
    
    		}
    		$numItemsiii = count($updateOrder);
    		$iii = 0;
    		foreach ($updateOrder as $updateOrdertwo ){
    
    				if(++$iii === $numItems) {
    				$updateOrderFinal .= "'orderfeatured' => ".$updateOrdertwo;
    				  }
    				else
    					$updateOrderFinal .= "'orderfeatured' => ".$updateOrdertwo .',';
    		}
    		echo "<div style='background:red;color:#ffffff;'><h1>jsonupdateOrderchangeorderVar = </h1><br /> ";
    		var_dump($changeorderVarstringFinal);
    		echo "</div>";
    		echo "<div style='background:red;color:#ffffff;'><h1>jsonupdateOrderchangeorderVar = </h1><br /> ";
    		var_dump($updateOrderFinal);
    		echo "</div>";
    
    		$wpdb->update(
    					'wp_hnes_table_sar_ram',
    					array($changeorderVarstringFinal),
    					array($updateOrderFinal),
    					array('%d','%d','%d'),
    					array( '%d','%d','%d' )
    		);//end update
    
    		exit( var_dump($wpdb->last_query ) );

    This part of the query is not dynamic yet, but does match the number of elements.

    array('%d','%d','%d'),
        array( '%d','%d','%d' )

The topic ‘Does WP query update accept variables being built into it?’ is closed to new replies.