Sorry everybody it was a typing error when assembling the email. The "WHEN" should have been "WHERE". I did use the "WHERE" when testing using MySQL Monitor and the statement $sql = "SELECT access_code FROM authorised_users (WHERE ) user_id = '$userid' AND user_password = '$password' AND account = '$account'"; also had the missing WHERE in during testing but once again it was a typing error when assembling the email.
Sorry about that. ----- Original Message ----- From: P. Ju (朱漢璇) To: NYPHP Talk ; [EMAIL PROTECTED] Sent: Friday, September 21, 2007 9:28 PM Subject: Re: [nyphp-talk] MySQL Monitor V PHP & MySQL Err, actually ignore the previous. However, where's your WHERE ? $sql = "SELECT access_code FROM authorised_users user_id = '$userid' AND user_password = '$password' AND account = '$account'"; You're missing a "WHERE" and in your MySQLMonitor statement, you typed WHEN. ?? I don't use that tool, but is that valid? Patricia On 9/21/07, PaulCheung <[EMAIL PROTECTED]> wrote: I have researched, checked and tried everything I can think of and still cannot get it to work. when using MySQL monitor the following works ================================= SELECT access_code FROM authorised_users WHEN user_id = 'Nancy' AND user_password = 'qwerty' AND account = '48572998'; Access_code is displayed = 11966552 When using PHP & MySQL ($userid='Nancy', $user_password='qwerty', $account='48572998') ==================== <?PHP session_start(); ob_start(); PHP?> <HTML><HEAD><TITLE>auth</TITLE></HEAD> <FORM action="X.php" id="primary" method="post"> <BODY> <?PHP $userid = $_POST['user']; $password = $_POST['passcode']; $account = $_POST['account']; $self = $_SERVER['PHP_SELF']; $referer = $_SERVER['HTTP_REFERER']; $access_code = $access_code - $access_code; /* FOR TEST ONLY */ echo ("user id = " . $userid . "<br>"); echo ("password = " . $password . "<br>"); echo ("account = " . $account . "<br>"); echo ("self = " . $self . "<br>"); /* VALIDATE FOR BLANK INPUT FIELD */ if( ( !$userid ) or ( !$password ) or (!$account) ) { header( "Location:$referer" ); exit(); } /*CONNECT TO MYSQL */ [EMAIL PROTECTED]( "localhost", "paul", "enter" ) or die( "Could not connect" ); /* CONNECT TO DATABASE */ $rs = @mysql_select_db( "test_db", $conn ) or die( "Could not select database" ); $rs = @mysql_select_db( "test_db", $conn ) or die( "Could not select database" ); $sql = "SELECT access_code FROM authorised_users user_id = '$userid' AND user_password = '$password' AND account = '$account'"; $rs = mysql_query( $sql, $conn ) or die( "Could not execute query" ); $num = mysql_numrows( $rs ); if( $num != 0 ) { $access_code = access_code; echo ("testcheckpoint - Welcome - your log-in succeeded!" . "<br>"); echo ("testcheckpoint - accesscode = " . access_code . "<BR>"); echo ('testcheckpoint - $accesscode = ' . $access_code . "<BR>"); } else { echo (" test checkpoint statement 55 " . "<br>"); header( "Location:$referer" ); exit(); } =========================================== this is what is returned from the test user id = Nancy password = qwerty account = 48572998 self = /tp_orth.php conn = Resource id #2 sql = SELECT access_code FROM authorised_users WHERE user_id = 'Nancy' AND user_password = 'qwerty' AND account = '48572998' access = 0 Welcome - your log-in succeeded! testcheckpoint - accesscode = access_code testcheckpoint - $accesscode = access_code I am trying to get the Access_code and cannot see what I am doing wrong P _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php -- Patricia Ju [EMAIL PROTECTED] +1-646-717-3871 success = f(perseverance)
_______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php