If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Jan 2003
    Member #
    I have some code that pulls values from a table based on the username and password values in that particular row. It goes:

    $sql= "SELECT bar_id, bar_spec, bar_desc, bar_event FROM bar_info WHERE ((bar_username='".$requiredusername."') AND (bar_password='".$requiredpassword."'))";

    $result = mysql_query($sql, $dbcnx);

    if (!$result) {
    echo( "<p>There was an error with your login. Try again.</p>");
    echo("<p><a href='barlogin.php'><img src='../Images/goback.jpg' width='136' height='41' border='0'></a>");
    The problem is that even if the user enters the wrong username or password the error isnt displayed. I have tried using the following also instead of if(!result):
    I have tried: if (empty($result)) ,if($result=="") ,if(!isset($result)
    none of these work either. It still brings up the page with the entry fields. Anyone got any ideas here? Thanks


  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Maryland, US
    Member #
    21 times
    PHP Code:
    if (mysql_num_rows($result) == 0
    filburt1, Web Design founder
    Site of the Month contest: submit your site or vote for the winner!

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 11:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: