From: deathmachine-pt- at hotmail dot com Operating system: windows xp PHP version: 5.2.6 PHP Bug Type: MySQL related Bug description: Fetch_array not working on function Warning: mysql_fetch_array():suppli
Description: ------------ Im using dreamweaver 8 php Im getting this same error on everytime i call a function with fetch array i have try so much times to solve it and had no luck i have the following function: function connect(){ mysql_connect("localhost","eensino_artur","deathmachine90"); mysql_select_db("eensino_patartur"); }; function idses(){ $email=$_SESSION["email"]; $uti=mysql_query("SELECT id,email FROM player WHERE email='$email'"); $linhauti=mysql_fetch_array($uti); $user=$linhauti["id"]; }; the connect function works but when i call the idses(); it gives me the following warning Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ... if i do this : $email=$_SESSION["email"]; $uti=mysql_query("SELECT id,email FROM player WHERE email='$email'"); $linhauti=mysql_fetch_array($uti); $user=$linhauti["id"]; as you see i use no function , it works 100% if i do the select on phpmyadmin mysql SELECT id,email FROM player WHERE email='[EMAIL PROTECTED]'; it works and selects the id. if i add to the function return $user; it doesnt work also im using phpMyAdmin - 2.10.1 and MySQL client version: 5.0.51a. Why does the fetch_array without function works on php and does not if i call it as a function even creating the same function on the php page im using it reproduces the same warning. What is the solution for this? Reproduce code: --------------- <?php function connect(){ mysql_connect("localhost","eensino_artur","deathmachine90"); mysql_select_db("eensino_patartur"); }; function idses(){ $email=$_SESSION["email"]; $uti=mysql_query("SELECT id,email FROM player WHERE email='$email'"); $linhauti=mysql_fetch_array($uti); $user=$linhauti["id"]; }; echo $user; also <?php connect(); idses(); echo $user; ?> Expected result: ---------------- echo of the mysql selection id using a session email Actual result: -------------- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in -- Edit bug report at http://bugs.php.net/?id=45548&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45548&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45548&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45548&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45548&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45548&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45548&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45548&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45548&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45548&r=support Expected behavior: http://bugs.php.net/fix.php?id=45548&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45548&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45548&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45548&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45548&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45548&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45548&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45548&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45548&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45548&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45548&r=mysqlcfg