Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2003, 09:29 AM
Dai Dai is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default error message help

I'm getting the following error message:

Parse error: parse error, unexpected T_VARIABLE in C:\FoxServ\www\my_sites\login.php on line 12

I've had a look in the manual but can't find a reference to T_variable. Any ideas on how to fix this error.



here are the two scripts:

dbconn.php
<?php
$host = "localhost";
$user = "Dai";
$password = "xxxxxx";
$dbname = "mysites";

$link = mysql_connect($host,$user,$pass);
mysql_select_db($dbname, $link);
?>


login.php
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>Title here!</title>
</head>
<body>
<?php
include "dbconn.php";
if (isset($submit))
     {
        $query = "SELECT * FROM login WHERE name = '$name' AND password = '$password'"
        $result = mysql_query($query);
        $isAuth = false;
         while ($row = mysql_fetch_array ($result))
             {
               if ($row['name']=== $name)
                 {
                    $isAuth = true;
                    session_start();
                    session_register('name');
                 }
              }
                     if ($isAuth)
                       {
                          echo "Logged in successfull";
                          echo "<a href=input.php>go to the site list</a>";
                       }
                       else
                           {
                              echo "Wrong username or password try again";
                           }


?>
</body>
</html>

What ever makes life easy
__________________
What ever makes life easy
 
Old July 1st, 2003, 12:44 PM
Authorized User
 
Join Date: Jun 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to natmaster Send a message via AIM to natmaster Send a message via MSN to natmaster
Default

this is a common problem. i get that kind of error when i accidently miss a semicolon or $ on a variable. it just means that your syntax is wrong.

in your case, on line 11, you missed a semicolon
($query = "SELECT * FROM login WHERE name = '$name' AND password = '$password'")
meaning the line after it would get confused. so with semicolon problems, it always tells you the line after it had problems

----------------------------
http://aeonofdarkness.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the error message for a 500 server error? chobo2 C# 2005 1 May 4th, 2008 03:11 AM
Where does the error message go? Wei Wang BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 March 13th, 2006 02:03 PM
Error Message alannoble26 Excel VBA 4 November 25th, 2005 11:20 AM
error message. Tasha Access VBA 2 August 11th, 2004 11:07 PM
Help with Error message mariakovacs Classic ASP Databases 3 October 10th, 2003 03:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.