ID:               45548
 User updated by:  deathmachine-pt- at hotmail dot com
 Reported By:      deathmachine-pt- at hotmail dot com
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: windows xp
 PHP Version:      5.2.6
 New Comment:

function idses(){
                                $email=$_SESSION["email"];
                                mysql_error($uti=mysql_query("SELECT id,email 
FROM player WHERE
email='$email'"));
                                $linhauti=mysql_fetch_array($uti);
                                $user=$linhauti["id"];
};


Previous Comments:
------------------------------------------------------------------------

[2008-07-17 19:42:43] deathmachine-pt- at hotmail dot com

Warning: mysql_error(): supplied resource is not a valid MySQL-Link
resource in /home/eensino/public_html/pat/artur/Projecto/functions.php
on line 9

------------------------------------------------------------------------

[2008-07-17 19:38:28] [EMAIL PROTECTED]

Use mysql_error() to know the error.

------------------------------------------------------------------------

[2008-07-17 19:34:51] deathmachine-pt- at hotmail dot com

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 this bug report at http://bugs.php.net/?id=45548&edit=1

Reply via email to