#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0

    Fetch data from database


    please what is problem with this code it is supposed to fetch an email address from a table called client but it returns nothing

    Note:I've setup the connection file correctly

    the script can communicate with the mysql database because I've been able to add new user details

    PHP Code:
     $colname_rsClient = "1";
    if (isset($_GET['email'])) {
      $colname_rsClient = (get_magic_quotes_gpc()) ? $_GET['email'] : addslashes($_GET['email']);
    }
    mysql_select_db($database_connHotel, $connHotel);
    $query_rsClient = sprintf("SELECT * FROM clients WHERE email = '%s'", $colname_rsClient);

    $rsClient = mysql_query($query_rsClient, $connHotel) or die(mysql_error());

    $row_rsClient = mysql_fetch_assoc($rsClient);

    $totalRows_rsClient = mysql_num_rows($rsClient);
    ?>

    <?php if ($totalRows_rsClient == 0) { // Show if recordset empty ?>

    <h1 align="center">Unable to Locate Email Address</h1>
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,924
    Rep Power
    1045
    Hi,

    I don't know where you got this code from, but the mysql_* functions are obsolete since almost 10 years, they're officially deprecated, and they will be removed sooner or later.

    How to (properly) access a MySQL database

    You're using other ancient techniques like those terrible "magic quotes" or the old align HTML attribute. If you have any chance of updating your code, then do that. It's stuck somewhere in the 90s.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0

    Thumbs up


    Originally Posted by Jacques1
    Hi,

    I don't know where you got this code from, but the mysql_* functions are obsolete since almost 10 years, they're officially deprecated, and they will be removed sooner or later.


    You're using other ancient techniques like those terrible "magic quotes" or the old align HTML attribute. If you have any chance of updating your code, then do that. It's stuck somewhere in the 90s.
    thanks a lot

IMN logo majestic logo threadwatch logo seochat tools logo