mysql_fetch_lengths.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. mysql_fetch_lengths()
  3. --SKIPIF--
  4. <?php
  5. require_once('skipif.inc');
  6. require_once('skipifconnectfailure.inc');
  7. ?>
  8. --FILE--
  9. <?php
  10. include "connect.inc";
  11. $tmp = NULL;
  12. $link = NULL;
  13. if (!is_null($tmp = @mysql_fetch_lengths()))
  14. printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  15. if (NULL !== ($tmp = @mysql_fetch_lengths($link)))
  16. printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  17. require('table.inc');
  18. if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1", $link)) {
  19. printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
  20. }
  21. while ($row = mysql_fetch_assoc($res))
  22. var_dump(mysql_fetch_lengths($res));
  23. var_dump(mysql_fetch_lengths($res));
  24. mysql_free_result($res);
  25. var_dump(mysql_fetch_lengths($res));
  26. mysql_close($link);
  27. print "done!";
  28. ?>
  29. --CLEAN--
  30. <?php
  31. require_once("clean_table.inc");
  32. ?>
  33. --EXPECTF--
  34. Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in %s on line %d
  35. array(2) {
  36. [0]=>
  37. int(1)
  38. [1]=>
  39. int(1)
  40. }
  41. bool(false)
  42. Warning: mysql_fetch_lengths(): %d is not a valid MySQL result resource in %s on line %d
  43. bool(false)
  44. done!