2003-02-12 08:46:29 +08:00
|
|
|
--TEST--
|
2008-01-08 20:49:42 +08:00
|
|
|
mysqli fetch char/text
|
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:06:53 +08:00
|
|
|
require_once('skipifconnectfailure.inc');
|
|
|
|
?>
|
2003-02-12 08:46:29 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
include ("connect.inc");
|
|
|
|
|
|
|
|
/*** test mysqli_connect 127.0.0.1 ***/
|
2009-09-24 20:51:03 +08:00
|
|
|
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
2007-10-10 18:06:53 +08:00
|
|
|
|
|
|
|
mysqli_select_db($link, $db);
|
|
|
|
|
|
|
|
if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
|
|
|
|
printf("[001] [%d] string\n", mysqli_errno($link), mysqli_error($link));
|
2008-01-08 20:49:42 +08:00
|
|
|
|
2007-10-10 18:06:53 +08:00
|
|
|
if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
|
|
|
|
printf("[002] [%d] string\n", mysqli_errno($link), mysqli_error($link));
|
2003-02-12 08:46:29 +08:00
|
|
|
|
2007-10-10 18:06:53 +08:00
|
|
|
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
|
|
|
|
printf("[003] [%d] string\n", mysqli_errno($link), mysqli_error($link));
|
2003-02-12 08:46:29 +08:00
|
|
|
|
2007-10-10 18:06:53 +08:00
|
|
|
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
|
|
|
|
printf("[004] [%d] string\n", mysqli_errno($link), mysqli_error($link));
|
2003-02-12 08:46:29 +08:00
|
|
|
|
2007-10-10 18:06:53 +08:00
|
|
|
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
|
|
|
|
printf("[005] [%d] string\n", mysqli_errno($link), mysqli_error($link));
|
|
|
|
|
|
|
|
if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
|
|
|
|
printf("[006] [%d] string\n", mysqli_errno($link), mysqli_error($link));
|
2003-02-12 08:46:29 +08:00
|
|
|
|
2006-01-02 00:52:05 +08:00
|
|
|
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1");
|
2003-06-29 05:30:58 +08:00
|
|
|
mysqli_bind_result($stmt, $c1, $c2);
|
2003-02-12 08:46:29 +08:00
|
|
|
mysqli_execute($stmt);
|
2007-10-10 18:06:53 +08:00
|
|
|
$i = 4;
|
2006-01-02 00:52:05 +08:00
|
|
|
while ($i--) {
|
|
|
|
mysqli_fetch($stmt);
|
2007-10-10 18:06:53 +08:00
|
|
|
$test = array($c1, $c2);
|
2006-01-02 00:52:05 +08:00
|
|
|
var_dump($test);
|
|
|
|
}
|
2003-02-12 08:46:29 +08:00
|
|
|
|
|
|
|
mysqli_stmt_close($stmt);
|
2008-01-08 20:49:42 +08:00
|
|
|
mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
|
2003-02-12 08:46:29 +08:00
|
|
|
mysqli_close($link);
|
2007-10-10 18:06:53 +08:00
|
|
|
print "done!";
|
2003-02-12 08:46:29 +08:00
|
|
|
?>
|
2009-07-06 22:39:10 +08:00
|
|
|
--CLEAN--
|
|
|
|
<?php
|
|
|
|
include "connect.inc";
|
2009-09-24 20:51:03 +08:00
|
|
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
2009-07-06 22:39:10 +08:00
|
|
|
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
|
|
|
|
|
|
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
|
|
|
|
printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
|
|
|
|
|
|
mysqli_close($link);
|
|
|
|
?>
|
2007-10-10 18:06:53 +08:00
|
|
|
--EXPECTF--
|
2003-02-12 08:46:29 +08:00
|
|
|
array(2) {
|
|
|
|
[0]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(10) "1234567890"
|
2003-02-12 08:46:29 +08:00
|
|
|
[1]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(15) "this is a test0"
|
2006-01-02 00:52:05 +08:00
|
|
|
}
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(10) "1234567891"
|
2006-01-02 00:52:05 +08:00
|
|
|
[1]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(15) "this is a test1"
|
2006-01-02 00:52:05 +08:00
|
|
|
}
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(10) "1234567892"
|
2006-01-02 00:52:05 +08:00
|
|
|
[1]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(15) "this is a test2"
|
2006-01-02 00:52:05 +08:00
|
|
|
}
|
|
|
|
array(2) {
|
|
|
|
[0]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(10) "1234567893"
|
2006-01-02 00:52:05 +08:00
|
|
|
[1]=>
|
2009-05-28 22:33:43 +08:00
|
|
|
%unicode|string%(15) "this is a test3"
|
2007-10-10 18:06:53 +08:00
|
|
|
}
|
|
|
|
done!
|