I've tried this but mysql_error() doesn't give me any errors, i tried my sql
line at the command line with success here is my code if some one could have
a look at it and give some suggestions as to how i can get the email ...

Thanks again

Peter

<?
session_start();
if ($REQUEST_METHOD=='POST')
{
header('Expires: ' . gmdate("D, d M Y H:i:s", time()+1000) . ' GMT');
header('Cache-Control: Private');
}
session_register('user');
session_register('pass');
session_register('email');
$session = session_id();
$userid = '$user';


?>

<html>
<head>
        <title>eRentals</title>
</head>

<body>
<?
// connect to data base
$open = mysql_connect("localhost", "root", "password")
    or die ("<font face=\"Helvetica, sans-serif\" size=\"3\"
color=\"#006699\">Unable to connect to server.</font>");
mysql_select_db("rentdb")
    or die ("<font face=\"Helvetica, sans-serif\" size=\"3\"
color=\"#006699\">Unable to select database.</font>");

// select id & email from  table matching the user name and password
inputted

$sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass'";
$result = mysql_query($sql)
    or die (print mysql_error());

// if unsuccessfull do this

$num = mysql_numrows($result)
    or die ("

        <font face=\"Helvetica, sans-serif\" size=\"3\" color=\"#006699\">You're
not authorized to be here.  If you feel you have recieved this<BR>
message in error, please contact the <a
href=\"mailto:[EMAIL PROTECTED]\">webmaster</a></font>

        ");
// if successful then do this
if ($num == 1) {



include "quote2.php"; //has a hidden field referencing the user & the email
address .. user shows up but again email does not
}

?>



</body>
</html>
-----Original Message-----
From: Philip Olson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 4:59 PM
To: Peter Houchin
Cc: PHP MAIL GROUP
Subject: RE: [PHP] SELECT statement


A possible way to find out :

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

Does it say anything?  mysql_error() is your friend, it can be printed
anywhere within the script and will print the last mysql error.  So
perhaps :

    print mysql_error();

Right before the query or ...

Regards,

Philip

On Tue, 13 Feb 2001, Peter Houchin wrote:

>
>
>
>
> ok I've changed my code to
>
> $sql = "SELECT id, email FROM users WHERE user='$user' and pass='$pass'";
> but still no joy can any one suggest why?
>
> (& Yes email is a field in the table)
>
> Peter
>
> > Hi,
> >
> > Can you have a SELECT statement (using mysql) that goes something like
> >
> > $sql="SELECT id && email FROM table WHERE user='$user' and
pass='$pass'";
>
>
> --
> PHP General 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]
>



-- 
PHP General 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