Hello,

I'm starting to learn how to manage databases with
MySQL/PHP. The program is very basic but I have a
strange error: "Resource id #3".
I read many things on Internet and understood that
others have this error because they are trying to echo
the pointer of the query and not the result itself.
It's not my case so I don't understand.

Thank you very much for your help.

<?
/*This program will log on to a users DB to check if
the user is allowed to log in or not.
The program checks the login and password of the user.
*/
$login="";
if (isset($_POST['login'])) {
   $login=$_POST['login'];
   }
if (isset($_POST['password'])) {
   $password=$_POST['password'];
   }

//log to the server
$db=mysql_connect("localhost","root","");
if ($db) {
//test if the connexion works
     $sel=mysql_select_db("test");
     if ($sel) {
        $sql_query="SELECT * FROM mytable WHERE
login='$login'";
        $result=mysql_query($sql_query);
        if ($result) {
           //check if there is a result
           echo $result;
           }
        //the query didn't work
        else echo mysql_error();
        }
else echo mysql_error();
}
?>



        

        
                
__________________________________________________________________
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to