could not retrieve data from database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gimpact
Forum Commoner
Posts: 65
Joined: Tue Jun 16, 2009 11:08 pm

could not retrieve data from database

Post 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
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: could not retrieve data from database

Post by Ollie Saunders »

$validat="SELECT * from customer_data where email='$email'";
$validate2=mysql_query($validate) or die(mysql_error());
gimpact
Forum Commoner
Posts: 65
Joined: Tue Jun 16, 2009 11:08 pm

Re: could not retrieve data from database

Post by gimpact »

Cool....I am so dumb! :oops:
Post Reply