faisalmukhtarch Posted November 12, 2014 Share Posted November 12, 2014 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 Quote Link to comment Share on other sites More sharing options...
AdRock Posted November 12, 2014 Share Posted November 12, 2014 Is that the error that gets output to the screen or in the error log? A bit more information would help. How are you trying to run it etc? Quote Link to comment Share on other sites More sharing options...
faisalmukhtarch Posted November 12, 2014 Author Share Posted November 12, 2014 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. Quote Link to comment Share on other sites More sharing options...
AdRock Posted November 12, 2014 Share Posted November 12, 2014 Have a look in your php.ini and see if short_open_tag is set to on. If no, you can set it to on otherwise replace <? with <?php Also it looks like it's reading that file code that connects to database as text Quote Link to comment Share on other sites More sharing options...
Barand Posted November 12, 2014 Share Posted November 12, 2014 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 Quote Link to comment Share on other sites More sharing options...
faisalmukhtarch Posted November 12, 2014 Author Share Posted November 12, 2014 Thanks AdRock Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.