PageRenderTime 77ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/test/zend/flaky/ext/mysql/tests/bug47438.php

http://github.com/facebook/hiphop-php
PHP | 40 lines | 31 code | 9 blank | 0 comment | 3 complexity | 6ae9f36ac532e589e660a905817e3955 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. require_once('connect.inc');
  3. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
  4. printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  5. $host, $user, $db, $port, $socket);
  6. mysql_select_db($db, $link);
  7. mysql_query("DROP TABLE IF EXISTS test_47438", $link);
  8. mysql_query("CREATE TABLE test_47438 (a INT, b INT, c INT)", $link);
  9. mysql_query("INSERT INTO test_47438 VALUES (10, 11, 12), (20, 21, 22)", $link);
  10. $result = mysql_query("SELECT * FROM test_47438", $link);
  11. mysql_field_seek($result, 1);
  12. $i = 0;
  13. while($i<mysql_num_fields($result))
  14. {
  15. $meta=mysql_fetch_field($result,$i);
  16. echo $i . "." . $meta->name . "\n";
  17. $i++;
  18. }
  19. mysql_query("DROP TABLE IF EXISTS test_47438", $link);
  20. ?>
  21. <?php error_reporting(0); ?>
  22. <?php
  23. require_once('connect.inc');
  24. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
  25. printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  26. $host, $user, $db, $port, $socket);
  27. if (!mysql_select_db($db, $link) ||
  28. !mysql_query("DROP TABLE IF EXISTS test_47438", $link))
  29. printf("[c002] [%d] %s\n", mysql_errno($link), mysql_error($link));
  30. mysql_close($link);
  31. ?>