2003-02-13 09:23:28 +08:00
|
|
|
--TEST--
|
|
|
|
mysqli_bind_param (UPDATE)
|
2004-12-04 16:50:33 +08:00
|
|
|
--SKIPIF--
|
2008-01-08 20:49:42 +08:00
|
|
|
<?php
|
|
|
|
require_once('skipif.inc');
|
2007-10-10 18:08:29 +08:00
|
|
|
require_once('skipifconnectfailure.inc');
|
|
|
|
?>
|
2003-02-13 09:23:28 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
include "connect.inc";
|
2007-10-10 18:08:29 +08:00
|
|
|
|
2003-02-13 09:23:28 +08:00
|
|
|
/*** test mysqli_connect 127.0.0.1 ***/
|
2007-10-10 18:08:29 +08:00
|
|
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
2003-02-13 09:23:28 +08:00
|
|
|
|
2007-10-10 18:08:29 +08:00
|
|
|
mysqli_select_db($link, $db);
|
2003-02-13 09:23:28 +08:00
|
|
|
|
2007-10-10 18:08:29 +08:00
|
|
|
mysqli_query($link,"DROP TABLE IF EXISTS test_update");
|
|
|
|
mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
|
2008-01-08 20:49:42 +08:00
|
|
|
b int) ENGINE=" . $engine);
|
2003-02-13 09:23:28 +08:00
|
|
|
|
|
|
|
mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
|
|
|
|
|
|
|
|
$stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
|
2004-02-11 15:39:28 +08:00
|
|
|
mysqli_bind_param($stmt, "sii", $c1, $c2, $c3);
|
2003-02-13 09:23:28 +08:00
|
|
|
|
|
|
|
$c1 = "Rasmus";
|
|
|
|
$c2 = 1;
|
|
|
|
$c3 = 2;
|
|
|
|
|
|
|
|
mysqli_execute($stmt);
|
|
|
|
mysqli_stmt_close($stmt);
|
|
|
|
|
|
|
|
$result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update");
|
|
|
|
$test = mysqli_fetch_row($result);
|
|
|
|
mysqli_free_result($result);
|
|
|
|
|
|
|
|
var_dump($test);
|
|
|
|
|
2008-01-08 20:49:42 +08:00
|
|
|
mysqli_query($link, "DROP TABLE IF EXISTS test_update");
|
2003-02-13 09:23:28 +08:00
|
|
|
mysqli_close($link);
|
2007-10-10 18:08:29 +08:00
|
|
|
print "done!";
|
2003-02-13 09:23:28 +08:00
|
|
|
?>
|
2007-10-10 18:08:29 +08:00
|
|
|
--EXPECTF--
|
2003-02-13 09:23:28 +08:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
string(15) "Rasmus is No. 1"
|
|
|
|
}
|
2007-10-10 18:08:29 +08:00
|
|
|
done!
|
|
|
|
--UEXPECF--
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
unicode(15) "Rasmus is No. 1"
|
|
|
|
}
|
|
|
|
done!
|