The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Help with unexpected T_ELSE
tyler.watkins
post May 24 2012, 01:53 PM
Post #1


Novice
**

Group: Members
Posts: 27
Joined: 6-March 12
Member No.: 16,654




Parse error: syntax error, unexpected T_ELSE in /home/a3535994/public_html/login.php on line 121

I get this error message and idk why. I am trying to make a login system for my website. Here is my code.


<?php
$mysql_host = "***********";
$mysql_database = "*****";
$mysql_user = "*************";
$mysql_password = "*********";


$user = $_POST['username'];
$password = $_POST['password'];



$con = mysql_connect( "$mysql_host", "$mysql_user", "$mysql_password" );
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("$mysql_database", $con) or die (mysql_error());

$login_user = mysql_query("SELECT username FROM user");
$login_pass = mysql_query("SELECT password FROM user");

if ('$login_user' === '$user' && '$login_pass' === '$password');
{
?>

<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
<script type="text/javascript" src="enter.js"></script>
<link href="style4.css" rel="stylesheet" media="all" type="text/css">
<script type="text/javascript">
function inputFocus(i){
if(i.value==i.defaultValue){ i.value=""; i.style.color=""; }
}
function inputBlur(i){
if(i.value==""){ i.value=i.defaultValue; i.style.color=""; }
}
</script>
<title>BLOCKS-Minecraft Maps and More</title>

<style type="text/css">
input.c2 {background-color:grey; text-style:times new roman;}
div.c1 {text-align: center}
</style>
</head>
<body>

<!--CONTAINER-->
<div class="container">
<div class="c1">
<div class="header"><br>
<h1>BLOCKS</h1>
<p>Minecraft Maps and More</p>
</div>

<!--LEFT SIDEBAR-->
<div class="lsbar">
<hr width="95%">
<a href="home.html">Home</a>
<hr width="95%">
<a href="http://blocks.forums.net.bz/">Forums</a>
<hr width="95%">
<a href="team.html">Our Team</a>
<hr width="95%">
<a href="tournaments.html">Tournaments</a>
<hr width="95%">
<a href="downloads.html">Downloads</a>
<hr width="95%">
<a href="register.html">Register</a>
<hr width="95%">
<!--<a href="#">Help</a>
<hr width="95%" color="black">--></div>

<!--CONTENT-->
<div class="content">
<div class="content-header c1">
<h1>What is Blocks?</h1>
</div>
<p>Welcome to Blocks. Here you can find and download Minecraft Maps and enter into awesome Minecraft Tournaments, oh and IT'S ALL FREE!!!</p>
<div class="content-header c1">
<h1>What are the Tournaments?</h1>
</div>
<p>The tournaments you can enter here are unlike any other! If you enjoy minecraft, then you should sign up for this site. The tournaments could range from crafting something in a specified space to creating a whole map! Check out the <a href="tournaments.html">Tournaments</a> page for more information.</p>
<div class="content-header c1">
<h1>When are the Tournaments?</h1>
</div>
<p>Check out the <a href="tournaments.html">Tournaments</a> page to find out when you can start siging up for tournaments and for a complete list of upcoming tournaments!</p>
<div class="content-header c1">
<h1>Worm's Blog</h1>
</div>
<p>Check <a href="worm.html">Here</a> to see updates and to leave comments!</p>
<br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>

<!--RIGHT SIDEBAR-->
<div class="rsbar-signin">

<h2>SIGN IN</h2>
<br>
<p>Logged In</p>
<hr width="95%">
<h2>Why Register?</h2>
<p>Registering with us will make you eligible to join our Minecraft Tournaments. You will also be entered into our mailings list and will recieve emails containing information on upcoming maps and tournaments.</p>
</div>

<!--FOOTER-->
<center><div class="footer">©Blocks.netne.net</div></center>
</div>
</div>
</body>
</html>

<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
<?php
} else
{
?>
<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
<script type="text/javascript" src="enter.js"></script>
<link href="style4.css" rel="stylesheet" media="all" type="text/css">
<script type="text/javascript">
function inputFocus(i){
if(i.value==i.defaultValue){ i.value=""; i.style.color=""; }
}
function inputBlur(i){
if(i.value==""){ i.value=i.defaultValue; i.style.color=""; }
}
</script>
<title>BLOCKS-Minecraft Maps and More</title>

<style type="text/css">
input.c2 {background-color:grey; text-style:times new roman;}
div.c1 {text-align: center}
</style>
</head>
<body>

<!--CONTAINER-->
<div class="container">
<div class="c1">
<div class="header"><br>
<h1>BLOCKS</h1>
<p>Minecraft Maps and More</p>
</div>

<!--LEFT SIDEBAR-->
<div class="lsbar">
<hr width="95%">
<a href="home.html">Home</a>
<hr width="95%">
<a href="http://blocks.forums.net.bz/">Forums</a>
<hr width="95%">
<a href="team.html">Our Team</a>
<hr width="95%">
<a href="tournaments.html">Tournaments</a>
<hr width="95%">
<a href="downloads.html">Downloads</a>
<hr width="95%">
<a href="register.html">Register</a>
<hr width="95%">
<!--<a href="#">Help</a>
<hr width="95%" color="black">--></div>

<!--CONTENT-->
<div class="content">
<div class="content-header c1">
<h1>What is Blocks?</h1>
</div>
<p>Welcome to Blocks. Here you can find and download Minecraft Maps and enter into awesome Minecraft Tournaments, oh and IT'S ALL FREE!!!</p>
<div class="content-header c1">
<h1>What are the Tournaments?</h1>
</div>
<p>The tournaments you can enter here are unlike any other! If you enjoy minecraft, then you should sign up for this site. The tournaments could range from crafting something in a specified space to creating a whole map! Check out the <a href="tournaments.html">Tournaments</a> page for more information.</p>
<div class="content-header c1">
<h1>When are the Tournaments?</h1>
</div>
<p>Check out the <a href="tournaments.html">Tournaments</a> page to find out when you can start siging up for tournaments and for a complete list of upcoming tournaments!</p>
<div class="content-header c1">
<h1>Worm's Blog</h1>
</div>
<p>Check <a href="worm.html">Here</a> to see updates and to leave comments!</p>
<br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>

<!--RIGHT SIDEBAR-->
<div class="rsbar-signin">

<h2>SIGN IN</h2>
<br>
<p>Incorrect Username or Password</p>
<hr width="95%">
<h2>Why Register?</h2>
<p>Registering with us will make you eligible to join our Minecraft Tournaments. You will also be entered into our mailings list and will recieve emails containing information on upcoming maps and tournaments.</p>
</div>

<!--FOOTER-->
<center><div class="footer">©Blocks.netne.net</div></center>
</div>
</div>
</body>
</html>

<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->

<?php
}
mysql_close($con);

?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Ephraim F. Moya
post May 26 2012, 03:20 PM
Post #2


Advanced Member
****

Group: Members
Posts: 167
Joined: 2-September 07
From: New Mexico
Member No.: 3,702



What you get from a mysql_query is a resource handle, not a variable name. A resource handle id's the particular data you asked for in the SELECT statement. Now you have to look for the particular data pair of interest and do something with it.

So first: connect to the database,
Second: perform a query to get a resource id.
Third: use the resource id to translate the dataset to a form you can use.
Fourth: examine the dataset, entry by entry, to find the particular data you're looking for.
If you find it, do one thing,
If you don't find it, do another thing.

BTW, there is mysql and there is mysqli. Which one do you want to use?



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 09:25 AM