Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

[help]Parse error: syntax error, unexpected $end

syntax syntax error

  • Please log in to reply
3 replies to this topic

#1 kiddies

kiddies

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 129 posts

Posted 18 July 2010 - 07:59 AM

any body help to fix this Parse error
this my source:
<?php
session_start();
session_register("username");

if ((!$username) or (!$password))
echo "login tidak lengkap";
else
{
$koneksi = mysql_connect("localhost","root","1234") or die (mysql_error());
echo "LOgin tidak lengkap";
mysql_select_db("php",$koneksi);

$pass = md5($password);

$query_login = mysql_query("select count(*) as login from anggota where username='$username' and password='$pass'",$koneksi) or die (mysql_error());

$rows = mysql_fetch_array($query_login);
if ($rows["login"]=="1")
{
session_register("username");

header("location:member.php");
}
else
header("location:bukan_member.php");
}
?>

thanks before
  • 0

#2 Alex-V

Alex-V

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 18 July 2010 - 10:16 AM

Why do you have session_register("username"); in 2. line and how can you use $username and $password if you didnt declare them?
  • 0

#3 Scuby

Scuby

    CC Lurker

  • Just Joined
  • Pip
  • 8 posts

Posted 18 July 2010 - 01:53 PM

<?php
session_start();
session_register("username");

if ((!$username) or (!$password))
     echo "login tidak lengkap";

else
     {
     $koneksi = mysql_connect("localhost","root","1234") or die (mysql_error());
     echo "LOgin tidak lengkap";
     mysql_select_db("php",$koneksi);

     $pass = md5($password);

     $query_login = mysql_query("select count(*) as login from anggota where username='$username' and password='$pass'",$koneksi) or die (mysql_error());

     $rows = mysql_fetch_array($query_login);
     if ($rows["login"]=="1")
          {
          session_register("username");

          header("location:member.php");
          }
     else
          header("location:bukan_member.php");
          }
     [B][COLOR="red"]}[/COLOR][/B]
?>

just take another look on your script and you'll see that there is one missing "}" ... at the end of the script... ;)
  • 0

#4 Alex-V

Alex-V

    CC Lurker

  • Just Joined
  • Pip
  • 3 posts

Posted 18 July 2010 - 01:58 PM

You should look again
<?php
session_start();
session_register("username");

if ((!$username) or (!$password))
     echo "login tidak lengkap";

else
{
     $koneksi = mysql_connect("localhost","root","1234") or die (mysql_error());
     echo "LOgin tidak lengkap";
     mysql_select_db("php",$koneksi);

     $pass = md5($password);

     $query_login = mysql_query("select count(*) as login from anggota where username='$username' and password='$pass'",$koneksi) or die (mysql_error());

     $rows = mysql_fetch_array($query_login);
     if ($rows["login"]=="1")
     {
          session_register("username");

          header("location:member.php");
     }
     else
          header("location:bukan_member.php");
}
?>

  • 0





Also tagged with one or more of these keywords: syntax, syntax error

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download