MySQLi Prepared Statement

$dbhost = "localhost";
$dbuser = "db_user";
$dbpass = "db_password";
$dbname = "db_name";
$mysqli = new mysqli( $dbhost, $dbuser, $dbpass, $dbname );

$q = "UPDATE table_name ";
$q .= "SET column_1 = ?, ";
$q .= "column_2 = ? ";
$q .= "WHERE column_3 = ? ";
$update = $mysqli->prepare( $q );
$update->bind_param( 'sii', $string_value, $integer_value, $integer_value );
$update->execute();

2 Comments

You must be logged in to post a comment.


  1. Glad to be a part of it! although there were no balloons and ed mcmahon with a large check to celebrate.


  2. Code Collective Snippet # 500. UN-fluffed at that. 500 'real', and 'real helpful' code snippets.