Jump to content

im new to this could some one please help me out.


Renlok

Recommended Posts

ok im new to php, been learning it for about a week.
and im trying to create a login ive put together a code for it from different lessons ive come across and here it is:
[code]
<?php
  session_start();
  include("MySQL_connection.php");
  switch (@$_GET['do'])
  {
      case "login":
      $connection = mysql_connect($host, $user,$password)
                    or die ("Could not Connect to Sever");
      $db = mysql_select_db($database, $connection)
                    or die("Could not Select Database");
      $sql = "SELECT loginName FROM User
              WHERE loginName='$_POST[fusername]'
              AND password=password('$_POST[fpassword]')";
      $result = mysql_query($sql)
  or die("could not carry out query");
  $num = mysql_mun_rows($result);
  if ($num > 0)
  {
  $_SESSION['auth']="yes";
$logname=$_POST['fusername'];
$_SESSION['logname'] = $logname;
$today = date("Y-m-d h:m:s");
$sql = "INSERT INTO Login(loginName,loginTime)
VALUES ('$logname','$today')";
mysql_query($sql) or die("Could not exacute query");
header("Location: Home.htm");
}
else
{
unset($do);
$message="There has been an error";
}
?>
[/code]
but when i run it i get the error
Parse error: [b]parse error, unexpected $end in \\nas18ent\domains\c\capersofkilwinning.co.uk\user\htdocs\main\login.php on line 29[/b]
ive no idea whats wrong.
If you are getting that error then you have a missing closing curly bracket (}) or a missing closing bracket )

From looking at the posted you haved closed the case or closed the swtich statment. This is why you are getting the above error.

Add the following:
[code]    break;
}[/code]
before ?> at the bottom of your code.
  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.