Click here to Skip to main content
14,983,502 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<?php <br mode="hold" /?>
	Your Sample Code is here
	//This makes sure they did not leave any field blank
	die('You did not complete all of the required fields');
	My Changes are here	*********************************************************************************************************************************/
	if(empty($_POST['Username']) || empty($_POST['Password']))
		die('You did not complete all of the required fields');
Updated 26-Dec-20 5:39am
enhzflep 15-Nov-12 3:25am
You want us to count lines for you?
Edit your question, indicate the line that has a problem in it.
Following that, actually ASK a question.
My 1.
CodingLover 15-Nov-12 3:42am
What you have on line 12?


You have an | at the end so it says |). That's the issue. It expects another condition before the ), you don't have too many brackets.
Hi thanks it worked and gone through but the database connection now is the one giving an errors:
Unidentified variable username in C:wamp\Adulteducation\DatabaseConn.php on line 8
Unidentified variable password in C:wamp\Adulteducation\DatabaseConn.php on line 8
Unidentified variable host in C:wamp\Adulteducation\DatabaseConn.php on line 8
The numbers are the lines. Thanks, I will appreciate i am a novice to php so I am trying to learn.

1. 2. //Database connection
3. $db_host ="localhost";
4. $db_user ="root";
5. $db_password ="";
6. $db_database ="e-farmer portal";
8. $connection=mysql_connect($host,$username,$password);
9. mysql_select_db("smith auto") or die(mysql_error());
10. ?>
DinoRondelly 15-Nov-12 12:17pm
Where did you declare $host,$Username,$Password?

Unidentified variable username means that the variable username isnt declared.

If i had to guess if you changed line 8 to look like the line below it would work
$connection = mysql_connect($db_host,$db_user,$db_passowrd)
DinoRondelly thanks but am I missing something on the code below, I am getting the error:
Parse error: syntax error, unexpected '[' in C:\wamp\www\AdultEducation\index.php on line 11

line 11 is the one in bold. Kindly assist. I appreciate the effort.

This page authenticate users before they can acccess their protected pages
only registered Consumers can login. The idea and the concept:
//Starting a session
echo 'Welcome to Farmer Broker';


//Connection to the Database
require ('');
//This code runs if the the form has been submitted
//Username and Password sent from the form

//To protect MySQL injection

//Retrieving information from the table
$sql="SELECT Username,Password,Status FROM Consumer
WHERE Username='$user' AND Password=password('$password')";
$row = mysql_fetch_array($result);

//Mysql num row is counting table row

//If result matched $username and $password, table row must be 1 row
header ("location:Verify.php");
header ("location:Home.php");}
//If the username and/or the password is wrong the error message is displayed
$msg="Invalid Username and/or Password";
Make sure you have PHP >= 7.0.0 on your system. I'm guessing perhaps your command line PHP version isn't the same as the one your web server uses. Make sure your php-cli is also at 7+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900