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. Quote 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. Quote 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 Quote 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 ?? Quote 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); Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.