Annotation of embedaddon/php/ext/mysql/tests/002.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: mysql_fetch_array
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: require_once('skipifconnectfailure.inc');
7: ?>
8: --FILE--
9: <?php
10: require_once('connect.inc');
11:
12: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
13: printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
14: $host, $user, $db, $port, $socket);
15:
16: var_dump($link);
17:
18: var_dump(mysql_query('DROP TABLE IF EXISTS test'));
19:
20: var_dump(mysql_query('CREATE TABLE test(col1 int PRIMARY KEY, col2 varchar(50), col3 char(5))'));
21:
22: var_dump(mysql_query("INSERT INTO test(col1, col2, col3) VALUES(1, 'foo', 'bar'),(2, 'foo', 'bar')"));
23:
24: var_dump($res = mysql_query('SELECT col1, col2, col3 FROM test ORDER BY col1 ASC'));
25:
26: while ($data = mysql_fetch_array($res, MYSQL_ASSOC)) {
27: var_dump($data);
28: }
29:
30: mysql_free_result($res);
31: mysql_close($link);
32:
33: print "done!";
34: ?>
35: --CLEAN--
36: <?php
37: require_once("clean_table.inc");
38: ?>
39: --EXPECTF--
40: resource(%d) of type (mysql link)
41: bool(true)
42: bool(true)
43: bool(true)
44: resource(%d) of type (mysql result)
45: array(3) {
46: [%u|b%"col1"]=>
47: %unicode|string%(1) "1"
48: [%u|b%"col2"]=>
49: %unicode|string%(3) "foo"
50: [%u|b%"col3"]=>
51: %unicode|string%(3) "bar"
52: }
53: array(3) {
54: [%u|b%"col1"]=>
55: %unicode|string%(1) "2"
56: [%u|b%"col2"]=>
57: %unicode|string%(3) "foo"
58: [%u|b%"col3"]=>
59: %unicode|string%(3) "bar"
60: }
61: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>