uw Mon Jul 23 12:16:55 2007 UTC
Added files:
/php-src/ext/mysqli/tests mysqli_fetch_array_assoc.phpt
mysqli_fetch_array_many_rows.phpt
mysqli_fetch_array_oo.phpt
mysqli_fetch_array.phpt
mysqli_fetch_assoc_bit.phpt
mysqli_fetch_assoc_no_alias.phpt
mysqli_fetch_assoc_no_alias_utf8.phpt
mysqli_fetch_assoc_oo.phpt
mysqli_fetch_assoc.phpt
mysqli_fetch_row.phpt
Log:
Tests for mysqli_fetch_assoc(), mysqli_fetch_array(), mysqli_fetch_row()
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
--TEST--
mysqli_fetch_array()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
require('table.inc');
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT
5")) {
printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[002]\n";
var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id
LIMIT 5")) {
printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[004]\n";
var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
mysqli_free_result($res);
mysqli_close($link);
print "done!";
?>
--EXPECTF--
[002]
array(2) {
["id"]=>
string(1) "1"
["label"]=>
string(1) "a"
}
[004]
array(2) {
["id"]=>
string(1) "1"
["label"]=>
string(1) "a"
}
done!
--UEXPECTF--
[002]
array(2) {
[u"id"]=>
unicode(1) "1"
[u"label"]=>
unicode(1) "a"
}
[004]
array(2) {
[u"id"]=>
unicode(1) "1"
[u"label"]=>
unicode(1) "a"
}
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
--TEST--
mysqli_fetch_array()
--SKIPIF--
<?php
require_once('skipifemb.inc');
require_once('skipif.inc');
?>
--FILE--
<?php
include "connect.inc";
require("table.inc");
// do as much as we can do in 5 seconds
$start = microtime(true);
for ($id = 100, $start = microtime(true); (microtime(true) - $start) <
5; $id++) {
if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id,
label) VALUES (%d, '%s')",
$id, mysqli_real_escape_string($link, chr(65 + ($id %
26)))))) {
printf("[001] %s failed: [%d] %s\n", $sql,
mysqli_errno($link), mysqli_error($link));
break;
}
}
if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link),
mysqli_errno($link));
}
while ($row = mysqli_fetch_array($res)) {
// overwrite results and check if the cache magic works
$row['label'] = NULL;
}
mysqli_free_result($res);
if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link),
mysqli_errno($link));
}
$i = 0;
$results = array();
while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
// create copies and destroy later
$results[$i++] = &$row;
if ($i % 999) {
$results = array();
}
if ($row[0] < 0 || $row[0] > $id) {
printf("[004] Unexpected result row[0] = '%s' (range
0...%d), [%d] %s\n",
$row[0], $id, mysqli_errno($link),
mysqli_error($link));
break;
}
if ($row[0] !== $row['id']) {
printf("[005] Unexpected result row[0] = '%s', row[id]
= '%s', [%d] %s\n",
$row[0], $row[id], mysqli_errno($link),
mysqli_error($link));
break;
}
$len = strlen($row[1]);
if (!is_string($row[1]) || $len == 0 || $len > 1) {
printf("[006] Unexpected result row[1] = '%s', [%d]
%s\n",
$row[1], mysqli_errno($link),
mysqli_error($link));
break;
}
if ($row[1] !== $row['label']) {
printf("[007] Unexpected result row[1] = '%s',
row[label] = '%s', [%d] %s\n",
$row[1], $row['label'], mysqli_errno($link),
mysqli_error($link));
break;
}
}
mysqli_free_result($res);
if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link),
mysqli_errno($link));
}
while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
// overwrite results and check if the cache magic works
$row['label'] = NULL;
}
mysqli_free_result($res);
if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) {
printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link),
mysqli_errno($link));
}
$row = mysqli_fetch_assoc($res);
$num = $row['num'];
mysqli_free_result($res);
if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link),
mysqli_errno($link));
}
$i = 0;
while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
// overwrite results and check if the cache magic works
$row[0] = NULL;
$i++;
}
mysqli_free_result($res);
if ($i != $num)
printf("[011] Expecting %d results, got %d results, [%d] %s\n",
$num, $i, mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
print "done!";
?>
--EXPECTF--
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_array_oo.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
--TEST--
mysqli->fetch_array()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
require('table.inc');
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 5")) {
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
print "[005]\n";
var_dump($res->fetch_array());
print "[006]\n";
var_dump($res->fetch_array(MYSQLI_NUM));
print "[007]\n";
var_dump($res->fetch_array(MYSQLI_BOTH));
print "[008]\n";
var_dump($res->fetch_array(MYSQLI_ASSOC));
print "[009]\n";
var_dump($res->fetch_array());
$res->free_result();
if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL
AS d, true AS e")) {
printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno,
$$mysqli->error);
}
print "[011]\n";
var_dump($res->fetch_array(MYSQLI_BOTH));
$res->free_result();
if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
printf("[012] Cannot run query, [%d] %s\n",
$mysqli->errno, $$mysqli->error);
exit(1);
}
do {
$illegal_mode = mt_rand(-10000, 10000);
} while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM,
MYSQLI_BOTH)));
// NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid
result modes.
$tmp = $res->fetch_array($illegal_mode);
if (false !== $tmp)
printf("[013] Expecting boolean/false although, got %s/%s. [%d]
%s\n",
gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
$tmp = $res->fetch_array($illegal_mode);
if (false !== $tmp)
printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
$res->free_result();
function func_mysqli_fetch_array($mysqli, $engine, $sql_type,
$sql_value, $php_value, $offset, $regexp_comparison = NULL) {
if (!$mysqli->query("DROP TABLE IF EXISTS test")) {
printf("[%04d] [%d] %s\n", $offset, $mysqli->errno,
$mysqli->error);
return false;
}
if (!$mysqli->query($sql = sprintf("CREATE TABLE test(id INT
NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
print $sql;
// don't bail, engine might not support the datatype
return false;
}
if (is_null($php_value) && !$mysqli->query($sql =
sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno,
$mysqli->error);
return false;
}
if (!is_null($php_value)) {
if (is_int($sql_value) &&
!$mysqli->query(sprintf("INSERT INTO test(id, label) VALUES (1, '%d')",
$sql_value))) {
printf("[%04d] [%d] %s\n", $offset + 1,
$mysqli->errno, $mysqli->error);
return false;
} else if (!is_int($sql_value) &&
!$mysqli->query(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')",
$sql_value))) {
printf("[%04d] [%d] %s\n", $offset + 1,
$mysqli->errno, $mysqli->error);
return false;
}
}
if (!$res = $mysqli->query("SELECT id, label FROM test")) {
printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno,
$mysqli->error);
return false;
}
if (!$row = $res->fetch_array(MYSQLI_BOTH)) {
printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno,
$mysqli->error);
return false;
}
$fields = mysqli_fetch_fields($res);
if (!(gettype($php_value)=="unicode" && ($fields[1]->flags &
128))) {
if ($regexp_comparison) {
if (!preg_match($regexp_comparison,
(string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
printf("[%04d] Expecting %s/%s [reg exp
= %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
gettype($php_value),
$php_value, $regexp_comparison,
gettype($row[1]), $row[1],
gettype($row['label']),
$row['label'], $mysqli->errno, $mysqli->error);
return false;
}
} else {
if (($row['label'] !== $php_value) || ($row[1]
!= $php_value)) {
printf("[%04d] Expecting %s/%s, got
%s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
gettype($php_value), $php_value,
gettype($row[1]), $row[1],
gettype($row['label']),
$row['label'], $mysqli->errno, $mysqli->error);
return false;
}
}
}
return true;
}
function func_mysqli_fetch_array_make_string($len) {
$ret = '';
for ($i = 0; $i < $len; $i++)
$ret .= chr(mt_rand(65, 90));
return $ret;
}
func_mysqli_fetch_array($mysqli, $engine, "TINYINT", -11, "-11", 20);
func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30);
func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1",
40);
func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL,
NULL, 50);
func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60);
func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70);
func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80);
func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768",
100);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767",
110);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535,
"65535", 130);
func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL,
NULL, 140);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608,
"-8388608", 150);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607,
"8388607", 160);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED",
16777215, "16777215", 180);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL,
NULL, 190);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648,
"-2147483648", 200);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647,
"2147483647", 210);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED",
4294967295, "4294967295", 230);
func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL,
NULL, 240);
if ($IS_MYSQLND ||
((mysqli_get_server_version($link) >= 51000) &&
(mysqli_get_client_version($link) >= 51000))) {
func_mysqli_fetch_array($mysqli, $engine, "BIGINT",
-9223372036854775808, "-9223372036854775808", 250);
func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL,
260);
func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED",
18446744073709551615, "18446744073709551615", 270);
func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED",
NULL, NULL, 280);
}
func_mysqli_fetch_array($mysqli, $engine, "FLOAT", -9223372036854775808
- 1.1, "-9.22337e+18", 290, "/-9\.22337e\+[0]?18/iu");
func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300);
func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED",
18446744073709551615 + 1.1, "1.84467e+19", 310, "/1\.84467e\+[0]?19/iu");
func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL,
NULL, 320);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", -99999999.99,
"-99999999.99", 330);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL,
340);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED",
99999999.99, "99999999.99", 350);
func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED",
NULL, NULL, 360);
func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)",
-99999999.99, "-99999999.99", 370);
func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL,
380);
func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", 99999999.99,
"99999999.99", 390);
func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL,
400);
// don't care about date() strict TZ warnings...
$date = @date('Y-m-d');
func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410);
func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date,
420);
func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430);
$date = @date('Y-m-d H:i:s');
func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date,
440);
func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date,
$date, 450);
func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460);
func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date,
470);
$date = @date('H:i:s');
func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480);
func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date,
$date, 490);
func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500);
func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'),
@date('Y'), 510);
func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'),
@date('Y'), 520);
func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530);
$string255 = func_mysqli_fetch_array_make_string(255);
func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540);
func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255,
$string255, 550);
func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a",
560);
func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570);
$string65k = func_mysqli_fetch_array_make_string(65535);
func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580);
func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255,
$string255, 590);
func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65635)", $string65k,
$string65k, 600);
func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a",
"a", 610);
func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL,
620);
func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630);
func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a",
chr(0) . "a", 640);
func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b",
"b", 650);
func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660);
func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a",
670);
func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a",
chr(0) . "a", 680);
func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b",
"b", 690);
func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL,
700);
func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710);
func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a",
chr(0) . "a", 720);
func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b",
"b", 730);
func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740);
func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750);
func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a",
"a", 760);
func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770);
func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780);
func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0)
. "a", 780);
func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790);
func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800);
func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0)
. "a", 810);
func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a",
chr(0) . "a", 840);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL,
850);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a",
chr(0) . "a", 870);
func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL,
880);
func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890);
func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a",
chr(0) . "a", 900);
func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910);
func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a",
920);
func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL,
930);
func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a",
940);
func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL,
950);
$mysqli->close();
if (null !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
print "done!";
?>
--EXPECTF--
[005]
array(4) {
[0]=>
string(1) "1"
["id"]=>
string(1) "1"
[1]=>
string(1) "a"
["label"]=>
string(1) "a"
}
[006]
array(2) {
[0]=>
string(1) "2"
[1]=>
string(1) "b"
}
[007]
array(4) {
[0]=>
string(1) "3"
["id"]=>
string(1) "3"
[1]=>
string(1) "c"
["label"]=>
string(1) "c"
}
[008]
array(2) {
["id"]=>
string(1) "4"
["label"]=>
string(1) "d"
}
[009]
array(4) {
[0]=>
string(1) "5"
["id"]=>
string(1) "5"
[1]=>
string(1) "e"
["label"]=>
string(1) "e"
}
[011]
array(11) {
[0]=>
string(1) "1"
["a"]=>
string(1) "2"
[1]=>
string(1) "2"
[2]=>
string(1) "3"
["c"]=>
string(1) "3"
[3]=>
string(1) "4"
["C"]=>
string(1) "4"
[4]=>
NULL
["d"]=>
NULL
[5]=>
string(1) "1"
["e"]=>
string(1) "1"
}
Warning: mysqli_result::fetch_array(): The result type should be either
MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_result::fetch_array(): The result type should be either
MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on
line %d
done!
--UEXPECTF--
[005]
array(4) {
[0]=>
unicode(1) "1"
[u"id"]=>
unicode(1) "1"
[1]=>
unicode(1) "a"
[u"label"]=>
unicode(1) "a"
}
[006]
array(2) {
[0]=>
unicode(1) "2"
[1]=>
unicode(1) "b"
}
[007]
array(4) {
[0]=>
unicode(1) "3"
[u"id"]=>
unicode(1) "3"
[1]=>
unicode(1) "c"
[u"label"]=>
unicode(1) "c"
}
[008]
array(2) {
[u"id"]=>
unicode(1) "4"
[u"label"]=>
unicode(1) "d"
}
[009]
array(4) {
[0]=>
unicode(1) "5"
[u"id"]=>
unicode(1) "5"
[1]=>
unicode(1) "e"
[u"label"]=>
unicode(1) "e"
}
[011]
array(11) {
[0]=>
unicode(1) "1"
[u"a"]=>
unicode(1) "2"
[1]=>
unicode(1) "2"
[2]=>
unicode(1) "3"
[u"c"]=>
unicode(1) "3"
[3]=>
unicode(1) "4"
[u"C"]=>
unicode(1) "4"
[4]=>
NULL
[u"d"]=>
NULL
[5]=>
unicode(1) "1"
[u"e"]=>
unicode(1) "1"
}
Warning: mysqli_result::fetch_array(): The result type should be either
MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_result::fetch_array(): The result type should be either
MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on
line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_array.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_array.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_array.phpt
--TEST--
mysqli_fetch_array() - all datatypes but BIT
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysqli_fetch_array()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_fetch_array($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
require('table.inc');
if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT
5")) {
printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[005]\n";
var_dump(mysqli_fetch_array($res));
print "[006]\n";
var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
print "[007]\n";
var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
print "[008]\n";
var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
print "[009]\n";
var_dump(mysqli_fetch_array($res));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C,
NULL AS d, true AS e")) {
printf("[010] Cannot run query, [%d] %s\n",
mysqli_errno($link), $mysqli_error($link));
}
print "[011]\n";
var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS
C")) {
printf("[012] Cannot run query, [%d] %s\n",
mysqli_errno($link), $mysqli_error($link));
exit(1);
}
do {
$illegal_mode = mt_rand(-10000, 10000);
} while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM,
MYSQLI_BOTH)));
// NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid
result modes.
$tmp = mysqli_fetch_array($res, $illegal_mode);
if (false !== $tmp)
printf("[013] Expecting boolean/false although, got
%s/%s. [%d] %s\n",
gettype($tmp), $tmp, mysqli_errno($link),
mysqli_error($link));
$tmp = mysqli_fetch_array($res, $illegal_mode);
if (false !== $tmp)
printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
gettype($tmp), $tmp, mysqli_errno($link),
mysqli_error($link));
mysqli_free_result($res);
function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value,
$php_value, $offset, $regexp_comparison = NULL, $binary_type = false) {
if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
printf("[%04d] [%d] %s\n", $offset,
mysqli_errno($link), mysqli_error($link));
return false;
}
if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id
INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
print $sql;
// don't bail, engine might not support the datatype
return false;
}
if (is_null($php_value) && !mysqli_query($link, $sql =
sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
printf("[%04d] [%d] %s\n", $offset + 1,
mysqli_errno($link), mysqli_error($link));
return false;
}
if (!is_null($php_value)) {
if (is_int($sql_value) && !mysqli_query($link,
sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
printf("[%04d] [%d] %s\n", $offset + 1,
mysqli_errno($link), mysqli_error($link));
return false;
} else if (!is_int($sql_value) && !mysqli_query($link,
sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $sql_value))) {
printf("[%04d] [%d] %s\n", $offset + 1,
mysqli_errno($link), mysqli_error($link));
return false;
}
}
if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
printf("[%04d] [%d] %s\n", $offset + 2,
mysqli_errno($link), mysqli_error($link));
return false;
}
if (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
printf("[%04d] [%d] %s\n", $offset + 3,
mysqli_errno($link), mysqli_error($link));
return false;
}
if ($regexp_comparison) {
if (!preg_match($regexp_comparison,
(string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
printf("[%04d] Expecting %s/%s [reg exp = %s],
got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
gettype($php_value), $php_value,
$regexp_comparison,
gettype($row[1]), $row[1],
gettype($row['label']), $row['label'],
mysqli_errno($link), mysqli_error($link));
return false;
}
} else if ((gettype($php_value) == 'unicode') && $binary_type) {
// Unicode is on and we are told that the MySQL column
type is a binary type.
// Don't expect a unicode value from the database,
you'll get binary string
if (($row['label'] != $php_value) || ($row[1] !=
$php_value)) {
printf("[%04d] Expecting %s/%s, got %s/%s resp.
%s/%s. [%d] %s\n", $offset + 5,
gettype($php_value), $php_value,
gettype($row[1]), $row[1],
gettype($row['label']), $row['label'],
mysqli_errno($link), mysqli_error($link));
return false;
}
if (gettype($row['label']) == 'unicode') {
var_dump(mysqli_fetch_field_direct($res, 1),
$row['label']);
printf("[%04d] SQL Type: '%s', binary columns
are supposed to return binary string and not unicode\n",
$offset + 6, $sql_type);
return false;
}
} else {
if (($row['label'] !== $php_value) || ($row[1] !=
$php_value)) {
printf("[%04d] Expecting %s/%s, got %s/%s resp.
%s/%s. [%d] %s\n", $offset + 7,
gettype($php_value), $php_value,
gettype($row[1]), $row[1],
gettype($row['label']), $row['label'],
mysqli_errno($link), mysqli_error($link));
return false;
}
}
return true;
}
function func_mysqli_fetch_array_make_string($len) {
$ret = '';
for ($i = 0; $i < $len; $i++)
$ret .= chr(mt_rand(65, 90));
return $ret;
}
func_mysqli_fetch_array($link, $engine, "TINYINT", -11, "-11", 20);
func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30);
func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL,
50);
func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60);
func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70);
func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80);
func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90);
func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768",
100);
func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767",
110);
func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120);
func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535,
"65535", 130);
func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL,
NULL, 140);
func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608,
"-8388608", 150);
func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607,
"8388607", 160);
func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170);
func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215,
"16777215", 180);
func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL,
NULL, 190);
func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648,
"-2147483648", 200);
func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647,
"2147483647", 210);
func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220);
func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", 4294967295,
"4294967295", 230);
func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL,
240);
if ($IS_MYSQLND ||
((mysqli_get_server_version($link) >= 51000) &&
(mysqli_get_client_version($link) >= 51000))) {
func_mysqli_fetch_array($link, $engine, "BIGINT",
-9223372036854775808, "-9223372036854775808", 250);
func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL,
260);
func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED",
18446744073709551615, "18446744073709551615", 260);
func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED",
NULL, NULL, 280);
}
func_mysqli_fetch_array($link, $engine, "FLOAT", -9223372036854775808 -
1.1, "-9.22337e+18", 290, "/-9\.22337e\+[0]?18/iu");
func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300);
func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED",
18446744073709551615 + 1.1, "1.84467e+19", 310, "/1\.84467e\+[0]?19/iu");
func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL,
320);
func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", -99999999.99,
"-99999999.99", 330);
func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL,
340);
func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED",
99999999.99, "99999999.99", 350);
func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL,
NULL, 360);
func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", -99999999.99,
"-99999999.99", 370);
func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL,
380);
func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", 99999999.99,
"99999999.99", 390);
func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL,
400);
// don't care about date() strict TZ warnings...
$date = @date('Y-m-d');
func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410);
func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date,
420);
func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430);
$date = @date('Y-m-d H:i:s');
func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440);
func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date,
$date, 450);
func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460);
func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470);
$date = @date('H:i:s');
func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480);
func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date,
490);
func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500);
func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'),
510);
func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'),
@date('Y'), 520);
func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530);
$string255 = func_mysqli_fetch_array_make_string(255);
func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540);
func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255,
$string255, 550);
func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a",
560);
func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);
$string65k = func_mysqli_fetch_array_make_string(65535);
func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255,
$string255, 590);
func_mysqli_fetch_array($link, $engine, "VARCHAR(65635)", $string65k,
$string65k, 600);
func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a",
"a", 610);
func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630,
null, true);
func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a",
chr(0) . "a", 640, null, true);
func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b",
650, null, true);
func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660,
null, true);
func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670,
null, true);
func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a",
chr(0) . "a", 680, null, true);
func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b",
"b", 690, null, true);
func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL,
700, null, true);
func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710,
null, true);
func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a",
chr(0) . "a", 720, null, true);
func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b",
730, null, true);
func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740,
null, true);
func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750);
func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a",
760);
func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770);
func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null,
true);
func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) .
"a", 780, null, true);
func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null,
true);
func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800);
func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) .
"a", 810);
func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820);
func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830,
null, true);
func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a",
chr(0) . "a", 840, null, true);
func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850,
null, true);
func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860);
func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a",
chr(0) . "a", 870);
func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890,
null, true);
func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a",
chr(0) . "a", 900);
func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910,
null, true);
func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a",
920);
func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL,
930);
func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940);
func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL,
950);
mysqli_close($link);
if (null !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
print "done!";
?>
--EXPECTF--
[005]
array(4) {
[0]=>
string(1) "1"
["id"]=>
string(1) "1"
[1]=>
string(1) "a"
["label"]=>
string(1) "a"
}
[006]
array(2) {
[0]=>
string(1) "2"
[1]=>
string(1) "b"
}
[007]
array(4) {
[0]=>
string(1) "3"
["id"]=>
string(1) "3"
[1]=>
string(1) "c"
["label"]=>
string(1) "c"
}
[008]
array(2) {
["id"]=>
string(1) "4"
["label"]=>
string(1) "d"
}
[009]
array(4) {
[0]=>
string(1) "5"
["id"]=>
string(1) "5"
[1]=>
string(1) "e"
["label"]=>
string(1) "e"
}
[011]
array(11) {
[0]=>
string(1) "1"
["a"]=>
string(1) "2"
[1]=>
string(1) "2"
[2]=>
string(1) "3"
["c"]=>
string(1) "3"
[3]=>
string(1) "4"
["C"]=>
string(1) "4"
[4]=>
NULL
["d"]=>
NULL
[5]=>
string(1) "1"
["e"]=>
string(1) "1"
}
Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM,
MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM,
MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d
done!
--UEXPECTF--
[005]
array(4) {
[0]=>
unicode(1) "1"
[u"id"]=>
unicode(1) "1"
[1]=>
unicode(1) "a"
[u"label"]=>
unicode(1) "a"
}
[006]
array(2) {
[0]=>
unicode(1) "2"
[1]=>
unicode(1) "b"
}
[007]
array(4) {
[0]=>
unicode(1) "3"
[u"id"]=>
unicode(1) "3"
[1]=>
unicode(1) "c"
[u"label"]=>
unicode(1) "c"
}
[008]
array(2) {
[u"id"]=>
unicode(1) "4"
[u"label"]=>
unicode(1) "d"
}
[009]
array(4) {
[0]=>
unicode(1) "5"
[u"id"]=>
unicode(1) "5"
[1]=>
unicode(1) "e"
[u"label"]=>
unicode(1) "e"
}
[011]
array(11) {
[0]=>
unicode(1) "1"
[u"a"]=>
unicode(1) "2"
[1]=>
unicode(1) "2"
[2]=>
unicode(1) "3"
[u"c"]=>
unicode(1) "3"
[3]=>
unicode(1) "4"
[u"C"]=>
unicode(1) "4"
[4]=>
NULL
[u"d"]=>
NULL
[5]=>
unicode(1) "1"
[u"e"]=>
unicode(1) "1"
}
Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM,
MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM,
MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
--TEST--
mysqli_fetch_assoc() - BIT
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('connect.inc');
require_once('table.inc');
if (mysqli_get_server_version($link) < 50003)
// b'001' syntax not supported before 5.0.3
die("skip Syntax used for test not supported with MySQL Server
before 5.0.3");
if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
// better don't trust libmysql before 5.0.3
die("skip Syntax used for test not supported with MySQL Server
before 5.0.3");
?>
--FILE--
<?php
require('connect.inc');
function dec32bin($dec, $bits) {
$maxval = pow(2, $bits);
$bin = '';
for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
if (($dec / $bitval) >= 1) {
$bin .= '1';
$dec -= $bitval;
} else {
$bin .= '0';
}
}
return $bin;
}
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[001] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
for ($bits = 1; $bits <= 46; $bits++) {
if (1 == $bits)
$max_value = 1;
else
$max_value = pow(2, $bits) - 1;
$tests = 0;
if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
!mysqli_query($link, $sql = sprintf('CREATE TABLE
test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL)
ENGINE="%s"', $bits, $bits, $engine)))
printf("[002 - %d] [%d] %s\n",$bits,
mysqli_errno($link), mysqli_error($link));
$tests = 0;
$rand_max = mt_getrandmax();
while ($tests < 10) {
$tests++;
if (1 == $tests)
$value = 0;
else if (2 == $tests)
$value = $max_value;
else {
if ($max_value > $rand_max) {
$max_loops =
floor($max_value/$rand_max);
$num_loops = mt_rand(1, $max_loops);
$value = 0;
for ($i = 0; $i < $num_loops; $i++)
$value += mt_rand(0, $rand_max);
} else {
$value = mt_rand(0, $max_value);
}
}
$bin = ($bits < 32) ? decbin($value) : dec32bin($value,
$bits);
$sql = sprintf("INSERT INTO test(id, bit_value) VALUES
(%s, b'%s')", $value, $bin);
for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0');
$i++)
;
$bin2 = substr($bin, $i, strlen($bin));
if (!mysqli_query($link, $sql))
printf("[003 - %d] [%d] %s\n", $bits,
mysqli_errno($link), mysqli_error($link));
$sql = sprintf("SELECT id, BIN(bit_value) AS _bin,
bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s",
$value);
if (!$res = mysqli_query($link, $sql))
printf("[004 - %d] [%d] %s\n", $bits,
mysqli_errno($link), mysqli_error($link));
if (!$row = mysqli_fetch_assoc($res))
printf("[005 - %d] [%d] %s\n", $bits,
mysqli_errno($link), mysqli_error($link));
if (($value != $row['id']) || (($bin != $row['_bin'])
&& ($bin2 != $row['_bin']))) {
debug_zval_dump($row);
printf("[006 - %d] Insert of %s in BIT(%d)
column might have failed. id = %s, bin = %s (%s/%s)\n",
$bits, $value, $bits, $row['id'],
$row['_bin'], $bin, $bin2);
break;
}
if ($value != $row['bit_value']) {
debug_zval_dump($row);
printf("%10s %64s\n%10s %64s\n", '_bin',
$row['_bin'], 'insert', $bin);
printf("[007 - %d] Expecting %s got %s\n",
$bits, $value, $row['bit_value']);
break;
}
if (null !== $row['bit_null']) {
debug_zval_dump($row);
printf("[008 - %d] Expecting null got %s/%s\n",
$bits, gettype($row['bit_value']), $row['bit_value']);
break;
}
}
}
mysqli_close($link);
print "done!";
?>
--EXPECTF--
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
--TEST--
mysqli_fetch_assoc()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
require('table.inc');
if (!$res = mysqli_query($link, "SELECT 1, 2")) {
printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[002]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) {
printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[004]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
printf("[005] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[006]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
printf("[007] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[008]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
/* Now do it with unbuffered queries */
if (!$res = mysqli_real_query($link, "SELECT 1, 2")) {
printf("[009] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_use_result($link)) {
printf("[010] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[011]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) {
printf("[012] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_use_result($link)) {
printf("[013] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[014]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
printf("[015] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_use_result($link)) {
printf("[016] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[017]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
printf("[015] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_use_result($link)) {
printf("[016] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[017]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
mysqli_close($link);
print "done!";
?>
--EXPECTF--
[002]
array(2) {
[1]=>
string(1) "1"
[2]=>
string(1) "2"
}
[004]
array(2) {
["a"]=>
string(1) "1"
[2]=>
string(1) "2"
}
[006]
array(2) {
["a"]=>
string(1) "1"
[2]=>
string(1) "2"
}
[008]
array(2) {
["a"]=>
string(1) "1"
[2]=>
string(1) "2"
}
[011]
array(2) {
[1]=>
string(1) "1"
[2]=>
string(1) "2"
}
[014]
array(2) {
["a"]=>
%s(1) "1"
[2]=>
%s(1) "2"
}
[017]
array(2) {
["a"]=>
string(1) "1"
[2]=>
string(1) "2"
}
[017]
array(2) {
["a"]=>
string(1) "1"
[2]=>
string(1) "2"
}
done!
--UEXPECTF--
[002]
array(2) {
[1]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[004]
array(2) {
[u"a"]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[006]
array(2) {
[u"a"]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[008]
array(2) {
[u"a"]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[011]
array(2) {
[1]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[014]
array(2) {
[u"a"]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[017]
array(2) {
[u"a"]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
[017]
array(2) {
[u"a"]=>
unicode(1) "1"
[2]=>
unicode(1) "2"
}
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
--TEST--
mysqli_fetch_assoc() - utf8
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require('connect.inc');
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
die("skip Cannot connect to server to check charsets");
if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'UTF8'"))
die("skip Cannot run SHOW CHARACTER SET to check charsets");
if (!$tmp = mysqli_fetch_assoc($res))
die("skip Looks like UTF8 is not available on the server");
if (strtolower($tmp['Charset']) !== 'utf8')
die("skip Not sure if UTF8 is available, cancelling the test");
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'UCS2'"))
die("skip Cannot run SHOW CHARACTER SET to check charsets");
if (!$tmp = mysqli_fetch_assoc($res))
die("skip Looks like UCS2 is not available on the server");
if (strtolower($tmp['Charset']) !== 'ucs2')
die("skip Not sure if UCS2 is available, cancelling the test");
mysqli_free_result($res);
mysqli_close($link);
?>
--FILE--
<?php
include "connect.inc";
require('table.inc');
/* some cyrillic (utf8) comes here */
if (!$res = mysqli_query($link, "SET NAMES UTF8")) {
printf("[001] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_query($link, "SELECT 1 AS 'ÐндÑей
Ð¥ÑиÑÑов', 2 AS 'Ð£Ð»Ñ Ðендел', 3 AS 'ÐеоÑг РиÑ
ÑеÑ'")) {
printf("[002] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[003]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "CREATE TABLE авÑоÑи_на_mysqlnd
(id integer not null auto_increment primary key, име varchar(20) character
set ucs2, ÑÐ°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) {
printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_query($link, "INSERT INTO авÑоÑи_на_mysqlnd
(име, ÑамилиÑ) VALUES ('ÐндÑей', 'Ð¥ÑиÑÑов'),
('ÐеоÑг', 'РиÑ
ÑеÑ'), ('УлÑ','Ðендел')")) {
printf("[005] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_query($link, "INSERT INTO авÑоÑи_на_mysqlnd
(име, ÑамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'),
('Ulf','Wendel')")) {
printf("[006] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_query($link, "INSERT INTO авÑоÑи_на_mysqlnd
(име, ÑамилиÑ) VALUES ('å®å¾·ç', 'Hristov'), ('æ ¼å¥¥å°',
'Richter'), ('ä¹å°å¤«','Wendel')")) {
printf("[007] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (!$res = mysqli_query($link, "SELECT id, име, ÑÐ°Ð¼Ð¸Ð»Ð¸Ñ FROM
авÑоÑи_на_mysqlnd ORDER BY ÑамилиÑ, име")) {
printf("[008] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[009]\n";
while ($row = mysqli_fetch_assoc($res)) {
var_dump($row);
}
mysqli_free_result($res);
if (!$res = mysqli_query($link, "DROP TABLE
авÑоÑи_на_mysqlnd")) {
printf("[010] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
mysqli_close($link);
print "done!";
?>
--EXPECTF--
[003]
array(3) {
["ÐндÑей Ð¥ÑиÑÑов"]=>
string(1) "1"
["Ð£Ð»Ñ Ðендел"]=>
string(1) "2"
["ÐеоÑг РиÑ
ÑеÑ"]=>
string(1) "3"
}
[009]
array(3) {
["id"]=>
string(1) "4"
["име"]=>
string(6) "Andrey"
["ÑамилиÑ"]=>
string(7) "Hristov"
}
array(3) {
["id"]=>
string(1) "7"
["име"]=>
string(9) "å®å¾·ç"
["ÑамилиÑ"]=>
string(7) "Hristov"
}
array(3) {
["id"]=>
string(1) "5"
["име"]=>
string(5) "Georg"
["ÑамилиÑ"]=>
string(7) "Richter"
}
array(3) {
["id"]=>
string(1) "8"
["име"]=>
string(9) "æ ¼å¥¥å°"
["ÑамилиÑ"]=>
string(7) "Richter"
}
array(3) {
["id"]=>
string(1) "6"
["име"]=>
string(3) "Ulf"
["ÑамилиÑ"]=>
string(6) "Wendel"
}
array(3) {
["id"]=>
string(1) "9"
["име"]=>
string(9) "ä¹å°å¤«"
["ÑамилиÑ"]=>
string(6) "Wendel"
}
array(3) {
["id"]=>
string(1) "3"
["име"]=>
string(6) "УлÑ"
["ÑамилиÑ"]=>
string(12) "Ðендел"
}
array(3) {
["id"]=>
string(1) "2"
["име"]=>
string(10) "ÐеоÑг"
["ÑамилиÑ"]=>
string(12) "РиÑ
ÑеÑ"
}
array(3) {
["id"]=>
string(1) "1"
["име"]=>
string(12) "ÐндÑей"
["ÑамилиÑ"]=>
string(14) "Ð¥ÑиÑÑов"
}
done!
--UEXPECTF--
[003]
array(3) {
[u"ÐндÑей Ð¥ÑиÑÑов"]=>
unicode(1) "1"
[u"Ð£Ð»Ñ Ðендел"]=>
unicode(1) "2"
[u"ÐеоÑг РиÑ
ÑеÑ"]=>
unicode(1) "3"
}
[009]
array(3) {
[u"id"]=>
unicode(1) "4"
[u"име"]=>
unicode(6) "Andrey"
[u"ÑамилиÑ"]=>
unicode(7) "Hristov"
}
array(3) {
[u"id"]=>
unicode(1) "7"
[u"име"]=>
unicode(3) "å®å¾·ç"
[u"ÑамилиÑ"]=>
unicode(7) "Hristov"
}
array(3) {
[u"id"]=>
unicode(1) "5"
[u"име"]=>
unicode(5) "Georg"
[u"ÑамилиÑ"]=>
unicode(7) "Richter"
}
array(3) {
[u"id"]=>
unicode(1) "8"
[u"име"]=>
unicode(3) "æ ¼å¥¥å°"
[u"ÑамилиÑ"]=>
unicode(7) "Richter"
}
array(3) {
[u"id"]=>
unicode(1) "6"
[u"име"]=>
unicode(3) "Ulf"
[u"ÑамилиÑ"]=>
unicode(6) "Wendel"
}
array(3) {
[u"id"]=>
unicode(1) "9"
[u"име"]=>
unicode(3) "ä¹å°å¤«"
[u"ÑамилиÑ"]=>
unicode(6) "Wendel"
}
array(3) {
[u"id"]=>
unicode(1) "3"
[u"име"]=>
unicode(3) "УлÑ"
[u"ÑамилиÑ"]=>
unicode(6) "Ðендел"
}
array(3) {
[u"id"]=>
unicode(1) "2"
[u"име"]=>
unicode(5) "ÐеоÑг"
[u"ÑамилиÑ"]=>
unicode(6) "РиÑ
ÑеÑ"
}
array(3) {
[u"id"]=>
unicode(1) "1"
[u"име"]=>
unicode(6) "ÐндÑей"
[u"ÑамилиÑ"]=>
unicode(7) "Ð¥ÑиÑÑов"
}
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
--TEST--
mysqli_fetch_assoc()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
// Note: no SQL type tests, internally the same function gets used as
for mysqli_fetch_array() which does a lot of SQL type test
$mysqli = new mysqli();
$res = @new mysqli_result($mysqli);
if (!is_null($tmp = @$res->fetch_assoc()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
require('table.inc');
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
printf("[002] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
if (!is_null($tmp = @$res->fetch_assoc($link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id
LIMIT 1")) {
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
print "[005]\n";
var_dump($res->fetch_assoc());
print "[006]\n";
var_dump($res->fetch_assoc());
$res->free_result();
if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL
AS d, true AS e")) {
printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno,
$mysqli->error);
}
print "[008]\n";
var_dump($res->fetch_assoc());
$res->free_result();
if (NULL !== ($tmp = $res->fetch_assoc()))
printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
mysqli_close($link);
print "done!";
?>
--EXPECTF--
[005]
array(2) {
["id"]=>
string(1) "1"
["label"]=>
string(1) "a"
}
[006]
NULL
[008]
array(5) {
["a"]=>
string(1) "2"
["c"]=>
string(1) "3"
["C"]=>
string(1) "4"
["d"]=>
NULL
["e"]=>
string(1) "1"
}
Warning: mysqli_result::fetch_assoc(): Couldn't fetch mysqli_result in %s on
line %d
done!
--UEXPECTF--
[005]
array(2) {
[u"id"]=>
unicode(1) "1"
[u"label"]=>
unicode(1) "a"
}
[006]
NULL
[008]
array(5) {
[u"a"]=>
unicode(1) "2"
[u"c"]=>
unicode(1) "3"
[u"C"]=>
unicode(1) "4"
[u"d"]=>
NULL
[u"e"]=>
unicode(1) "1"
}
Warning: mysqli_result::fetch_assoc(): Couldn't fetch mysqli_result in %s on
line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_assoc.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_assoc.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_assoc.phpt
--TEST--
mysqli_fetch_assoc()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
// Note: no SQL type tests, internally the same function gets used as
for mysqli_fetch_array() which does a lot of SQL type test
if (!is_null($tmp = @mysqli_fetch_assoc()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_fetch_assoc($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id
LIMIT 1")) {
printf("[004] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[005]\n";
var_dump(mysqli_fetch_assoc($res));
print "[006]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C,
NULL AS d, true AS e")) {
printf("[007] Cannot run query, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
}
print "[008]\n";
var_dump(mysqli_fetch_assoc($res));
mysqli_free_result($res);
if (NULL !== ($tmp = mysqli_fetch_assoc($res)))
printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
mysqli_close($link);
print "done!";
?>
--EXPECTF--
[005]
array(2) {
["id"]=>
string(1) "1"
["label"]=>
string(1) "a"
}
[006]
NULL
[008]
array(5) {
["a"]=>
string(1) "2"
["c"]=>
string(1) "3"
["C"]=>
string(1) "4"
["d"]=>
NULL
["e"]=>
string(1) "1"
}
Warning: mysqli_fetch_assoc(): Couldn't fetch mysqli_result in %s on line %d
done!
--UEXPECTF--
[005]
array(2) {
[u"id"]=>
unicode(1) "1"
[u"label"]=>
unicode(1) "a"
}
[006]
NULL
[008]
array(5) {
[u"a"]=>
unicode(1) "2"
[u"c"]=>
unicode(1) "3"
[u"C"]=>
unicode(1) "4"
[u"d"]=>
NULL
[u"e"]=>
unicode(1) "1"
}
Warning: mysqli_fetch_assoc(): Couldn't fetch mysqli_result in %s on line %d
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_row.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_fetch_row.phpt
+++ php-src/ext/mysqli/tests/mysqli_fetch_row.phpt
--TEST--
mysqli_fetch_row()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysqli_fetch_row()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_fetch_row($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
require('table.inc');
if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test
ORDER BY id LIMIT 1")) {
printf("[003] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
print "[004]\n";
var_dump(mysqli_fetch_row($res));
print "[005]\n";
var_dump(mysqli_fetch_row($res));
mysqli_free_result($res);
var_dump(mysqli_fetch_row($res));
mysqli_close($link);
print "done!";
?>
--EXPECTF--
[004]
array(3) {
[0]=>
string(1) "1"
[1]=>
string(1) "a"
[2]=>
string(1) "1"
}
[005]
NULL
Warning: mysqli_fetch_row(): Couldn't fetch mysqli_result in %s on line %d
NULL
done!
--UEXPECTF--
[004]
array(3) {
[0]=>
unicode(1) "1"
[1]=>
unicode(1) "a"
[2]=>
unicode(1) "1"
}
[005]
NULL
Warning: mysqli_fetch_row(): Couldn't fetch mysqli_result in %s on line %d
NULL
done!
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php