I've come across yet another problem.

I have a table set up that houses four things, a person's real name,
username, pass, and id.  The id is used to join another table which houses
that persons contacts.  I've been validating the user and pass by comparing
the number of rows that the sql statement returns.

Once the user submits their user/pass they're sent to the validation page
where the user and pass are compared and if they're valid another sql
statement takes place:
         $ci = "select contactid from users where username='$username' and
password='$password'";
         $cir = mysql_query($ci)or die("Couldn't execute");
         echo("<html><head><META HTTP-EQUIV=\"refresh\"
CONTENT=\"0;url=db.php\"></head></html>");

I've registered the variables $username, $password, & $cir and if the user
is validated they're sent to the contacts page.

On the contacts page I'm trying to select which contacts to show based on
the contact id.  This is what the code looks like on the page where the
contacts are going to be displayed...

        mysql_connect("localhost") or
             die("couldn't connect");
        mysql_select_db("act") or
             die("couldn't connect to the database");

        $ci = "select contactid from users where username='$username' and
password='$password'";
        $cir = mysql_query($ci)
            or die("Couldn't execute");
        $query = "select * from my_contacts where contactid='$cir'";

        $result = mysql_query($query) or
             die( mysql_error() );

When I try to print $cir to see if anything's getting passed I keep getting
something that reads "resource id #2".

If I were rename the variables in the $ci, $cir, and $query lines, run the
code, and try to print $cir again I'd get "resource id #3" and so on.

Does anyone know what this means and how I can work around it.

Thanks for your time.
Kevin



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to