1--TEST-- 2mysql_fetch_array 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10require_once('connect.inc'); 11 12if (!$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 16var_dump($link); 17 18var_dump(mysql_query('DROP TABLE IF EXISTS test')); 19 20var_dump(mysql_query('CREATE TABLE test(col1 int PRIMARY KEY, col2 varchar(50), col3 char(5))')); 21 22var_dump(mysql_query("INSERT INTO test(col1, col2, col3) VALUES(1, 'foo', 'bar'),(2, 'foo', 'bar')")); 23 24var_dump($res = mysql_query('SELECT col1, col2, col3 FROM test ORDER BY col1 ASC')); 25 26while ($data = mysql_fetch_array($res, MYSQL_ASSOC)) { 27 var_dump($data); 28} 29 30mysql_free_result($res); 31mysql_close($link); 32 33print "done!"; 34?> 35--CLEAN-- 36<?php 37require_once("clean_table.inc"); 38?> 39--EXPECTF-- 40resource(%d) of type (mysql link) 41bool(true) 42bool(true) 43bool(true) 44resource(%d) of type (mysql result) 45array(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} 53array(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} 61done! 62