Page 1 of 1

could not retrieve data from database

Posted: Wed Aug 19, 2009 9:40 pm
by gimpact
Hi,

I am making control panel. When the login is successful, i create a session to store email and use it validate every secure page. In the setting page, I have this code. I validate the user using email stored in the session and then use the same id to retrieve data from the database for display. I have one record in my database but some how every time, i query, it is giving me "QUERY WAS EMPTY" error. Please tell me where i am going wrong.

Code: Select all

<?php
session_start();
if(ISSET($_SESSION['email'])){
    $email = $_SESSION['email'];
    // Opend database connection
    include ("../inc/DBConnect.php");
    // Execute database query
    $validat="SELECT * from customer_data where email='$email'";
    $validate2=mysql_query($validate) or die(mysql_error());
    $validate3=mysql_fetch_array($validate2);
    if(strlen($validate3[email]>0)){
 
    $last_name = $validate3[last_name];
    $mobile = $validate3[mobile];
    $designation = $validate3[designation];
    $company_name = $validate3[company_name];
    $company_address = $validate3[company_address];
 
?>
 
HTML CODE for displaying records
 
<?php
Redirect code
?>
 
Thank you,
D

Re: could not retrieve data from database

Posted: Wed Aug 19, 2009 10:10 pm
by Ollie Saunders
$validat="SELECT * from customer_data where email='$email'";
$validate2=mysql_query($validate) or die(mysql_error());

Re: could not retrieve data from database

Posted: Thu Aug 20, 2009 3:57 am
by gimpact
Cool....I am so dumb! :oops: