Skip to main content
Answer has been updated
Source Link

When working with database in WordPress you should never use the low lever mysql_* or mysqli_* functions.

Always use $wpdb methods, in your case you should use prepare():

<?php
$query =$wpdb->query( $wpdb->prepare( 
    "UPDATE ".$wpdb->prefix."recommend_bets  
SET `title`title = '".$title."'%s,...
titleb = %s
WHERE ID = %d       
",
    'static', 'static2', 7
) ); 

//Or Or

$wpdb->update( 
    'table', 
    array( 
        'column1' => 'value1',  // string
        'column2' => 'value2'   // integer (number) 
    ), 
    array( 'ID' => 1 ), 
    array( 
        '%s',   // value1
        '%d'    // value2
    ), 
    array( '%d' ) 
);
?>

When working with database in WordPress you should never use the low lever mysql_* or mysqli_* functions.

Always use $wpdb methods, in your case you should use prepare():

<?php
$query = $wpdb->prepare("UPDATE ".$wpdb->prefix."recommend_bets SET `title` = '".$title."',...");
//Or 
$wpdb->update( 
    'table', 
    array( 
        'column1' => 'value1',  // string
        'column2' => 'value2'   // integer (number) 
    ), 
    array( 'ID' => 1 ), 
    array( 
        '%s',   // value1
        '%d'    // value2
    ), 
    array( '%d' ) 
);
?>

When working with database in WordPress you should never use the low lever mysql_* or mysqli_* functions.

Always use $wpdb methods, in your case you should use prepare():

<?php
$wpdb->query( $wpdb->prepare( 
    "UPDATE ".$wpdb->prefix."recommend_bets 
SET title = %s,
titleb = %s
WHERE ID = %d       
",
    'static', 'static2', 7
) ); 

// Or

$wpdb->update( 
    'table', 
    array( 
        'column1' => 'value1',  // string
        'column2' => 'value2'   // integer (number) 
    ), 
    array( 'ID' => 1 ), 
    array( 
        '%s',   // value1
        '%d'    // value2
    ), 
    array( '%d' ) 
);
?>
Source Link

When working with database in WordPress you should never use the low lever mysql_* or mysqli_* functions.

Always use $wpdb methods, in your case you should use prepare():

<?php
$query = $wpdb->prepare("UPDATE ".$wpdb->prefix."recommend_bets SET `title` = '".$title."',...");
//Or 
$wpdb->update( 
    'table', 
    array( 
        'column1' => 'value1',  // string
        'column2' => 'value2'   // integer (number) 
    ), 
    array( 'ID' => 1 ), 
    array( 
        '%s',   // value1
        '%d'    // value2
    ), 
    array( '%d' ) 
);
?>