Jump to content

[SOLVED] another unexpected $end


Styles2304

Recommended Posts

ok, I'm trying to make a session deal for user authentication . . . it constantly returns invalid user name and/or password.

 

Just to check what it's returning I did this:

 

<?php
//Starting the session and user authentication
session_start();
include "conn.inc.php";

if (isset($_POST['submit'])) {
  $query = "SELECT Username, Password FROM UserInfo " .
           "WHERE Username = '" . $_POST['username'] . "' " .
           "AND Password = (PASSWORD('" . $_POST['password'] . "'))";
  $result = mysql_query($query,$link)
    or die(mysql_error());
?>

<?php
echo $result;
?>

 

It gives me:

 

Parse error: syntax error, unexpected $end in /home/styles/public_html/login.php on line 16

which is the "?>"

 

I know it's syntax but I don't know what I'm doing wrong.

Link to comment
https://forums.phpfreaks.com/topic/64745-solved-another-unexpected-end/
Share on other sites

if (isset($_POST['submit'])) {

  $query = "SELECT Username, Password FROM UserInfo " .

          "WHERE Username = '" . $_POST['username'] . "' " .

          "AND Password = (PASSWORD('" . $_POST['password'] . "'))";

  $result = mysql_query($query,$link)

    or die(mysql_error());

}

?>

 

for the record, when you forget a curly, it runs code till end of page, meaning error is on last line, even if it isnt

Archived

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

×
×
  • Create New...

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.