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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.