Jump to content

Archived

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

Renlok

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

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
thanks for that, now i get no error but when you login it loads a blank page and its just like before you login when you load the page its surposed to go to after login

Share this post


Link to post
Share on other sites
$num = mysql_mun_rows($result);

should be

$num = mysql_[b]num[/b]_rows($result);

Share this post


Link to post
Share on other sites

×

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.