PageRenderTime 25ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 38 lines | 29 code | 9 blank | 0 comment | 3 complexity | 0deade0865939604488dd48f23d4aa28 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. ?><?php
  21. require_once('connect.inc');
  22. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
  23. printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  24. $host, $user, $db, $port, $socket);
  25. if (!mysql_select_db($db, $link) ||
  26. !mysql_query("DROP TABLE IF EXISTS test_47438", $link))
  27. printf("[c002] [%d] %s\n", mysql_errno($link), mysql_error($link));
  28. mysql_close($link);
  29. ?>