Jump to content


Photo

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


  • Please log in to reply
4 replies to this topic

#1 Renlok

Renlok
  • Members
  • PipPipPip
  • Advanced Member
  • 258 posts
  • Locationnewbury

Posted 31 August 2006 - 11:08 PM

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:
<?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";
			}
?>
but when i run it i get the error
Parse error: parse error, unexpected $end in \\nas18ent\domains\c\capersofkilwinning.co.uk\user\htdocs\main\login.php on line 29
ive no idea whats wrong.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 31 August 2006 - 11:11 PM

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:
    break;
}
before ?> at the bottom of your code.

#3 Renlok

Renlok
  • Members
  • PipPipPip
  • Advanced Member
  • 258 posts
  • Locationnewbury

Posted 01 September 2006 - 11:17 AM

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

#4 Renlok

Renlok
  • Members
  • PipPipPip
  • Advanced Member
  • 258 posts
  • Locationnewbury

Posted 10 September 2006 - 08:32 PM

??

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 10 September 2006 - 09:47 PM

$num = mysql_mun_rows($result);

should be

$num = mysql_num_rows($result);
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users