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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

  • 2 weeks later...
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.