Jump to content

Recommended Posts

Hi guys, 

I am new to PHP

I have a Friends website, which was working perfectly on his PC. When i tried to run it. i am getting the following error.

connect_db(); //================================================================================ if(isset($_POST['submit'])=="login"){ $where="( email='".mysql_real_escape_string($_POST["email"])."') and ( password='".mysql_real_escape_string($_POST["password"])."')"; $seldata=$nds->webdreamselect('tbl_users',$where,'','','',''); echo mysql_error(); if(mysql_num_rows($seldata)!=0){ $customer_details=mysql_fetch_array($seldata); echo mysql_error(); $_SESSION["member_id"]=$customer_details["id"]; header("location: home.php"); }else{ $message="Invalid Username / Password Please try again."; } } //================ ?>

The database file has sql extension. I used that file in PHPMYADMIN to to import the tables, and it went successful

But i am getting this error. 

Kindly help me out. 

If anyother information needed, let me know. 

Apologize if i did not follow the proper rules. 

Thanks 

Link to comment
https://forums.phpfreaks.com/topic/292419-help-needed-in-database-connection/
Share on other sites

Below are the screenshot of the problem i am having.

I also have attached the the screenshot of the code where it is refereeing to.

I am new to PHP, might be missing the basic things.

I have tried on XAMPP and WAMPP. but same problem. 

 

2a3gpc.jpg30w4948.jpg

If I format that mess of code from your first post (as you should have done) things become clearer

<?php
connect_db(); 
//================================================================================
if(isset($_POST['submit'])=="login"){ 
    $where="( email='".mysql_real_escape_string($_POST["email"])."') and ( password='".    mysql_real_escape_string($_POST["password"])."')"; 
    $seldata=$nds->webdreamselect('tbl_users',$where,'','','',''); 
    echo mysql_error(); 
    if(mysql_num_rows($seldata)!=0){ 
        $customer_details=mysql_fetch_array($seldata); 
        echo mysql_error(); 
        $_SESSION["member_id"]=$customer_details["id"]; 
        header("location: home.php"); 
    }else{ 
        $message="Invalid Username / Password Please try again."; 
    } 
} //================ 
?>

isset() returns true or false and so will not equal "login".

 

That line should be

if(isset($_POST['submit']) && $_POST['submit']=="login") { 

The code never executes and $message never gets a value, hence your "not defined" message

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.