Renlok Posted August 31, 2006 Share Posted August 31, 2006 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 https://forums.phpfreaks.com/topic/19305-im-new-to-this-could-some-one-please-help-me-out/ Share on other sites More sharing options...
wildteen88 Posted August 31, 2006 Share Posted August 31, 2006 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 https://forums.phpfreaks.com/topic/19305-im-new-to-this-could-some-one-please-help-me-out/#findComment-83737 Share on other sites More sharing options...
Renlok Posted September 1, 2006 Author Share Posted September 1, 2006 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 Link to comment https://forums.phpfreaks.com/topic/19305-im-new-to-this-could-some-one-please-help-me-out/#findComment-83941 Share on other sites More sharing options...
Renlok Posted September 10, 2006 Author Share Posted September 10, 2006 ?? Link to comment https://forums.phpfreaks.com/topic/19305-im-new-to-this-could-some-one-please-help-me-out/#findComment-89517 Share on other sites More sharing options...
AndyB Posted September 10, 2006 Share Posted September 10, 2006 $num = mysql_mun_rows($result);should be $num = mysql_[b]num[/b]_rows($result); Link to comment https://forums.phpfreaks.com/topic/19305-im-new-to-this-could-some-one-please-help-me-out/#findComment-89538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.