Wrox Programmer Forums
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 May 22nd, 2005, 06:14 AM
Registered User
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dynamic_iiita Send a message via Yahoo to dynamic_iiita
Default strange error

i have come accross an strange error ..I m new to php world. i have written the code as in auth_user of PHP4 and it is giving error in 115 line and toal no of lines in the code is 112 and the error shown is

Parse error: parse error, unexpected $ in /var/www/html/alok/auth_user1.php on line 115 and the code is

# FILE: common_db.inc
     $dbhost = "";
     $dbusername = "alok";
     $dbuserpassword = "alok";
     $default_dbname = "store";

     $MYSQL_ERRNO = "";
     $MYSQL_ERROR = "";

     function db_connect($dbname='') {
         global $dbhost, $dbusername, $dbuserpassword, $default_dbname;
         global $MYSQL_ERRNO, $MYSQL_ERROR;

         $link_id = mysql_connect ($dbhost, $dbusername, $dbuserpassword);
         if (!$link_id) {
             $MYSQL_ERRNO = 0;
             $MYSQL_ERROR = "Connection failed to the host $dbhost.";
             return 0;
         else if (empty($dbname) && !mysql_select_db($default_dbname)) {
             $MYSQL_ERRNO = mysql_errno();
             $MYSQL_ERROR = mysql_error();
             return 0;
         else if (!empty($dbname) && !mysql_select_db($dbname))
         else return $link_id;
//include "./common_db.inc";
function auth_user($username,$password)
     $query="select username from login_user where username='$username'and password=password('$password')";
     return 0;
         return $query_data[0];
function login_form(){
     global $PHP_SELF;
<form method="POST" action="<?echo$PHP_SELF;?>">
<div align "center"><center>
<h3>please login to access the page u requested.</h3>
<table border="1" width="200" cellpaddin="2">
<th width ="18%" align="right" nowrap>id</th>
<td width="82%" nowrap>
<input type ="text" name="username" size="8">
<th width="18%" align="right" nowrap>password</th>
<td width="82%" nowrap>
<input type="password" name="password" size="8">
<td width="100%" colspan="2" align="center" nowrap>
<input type="submit" value="login" name="submit">
if(!isset($username) | !($password))
    echo "Authentication failed".
         "you must enter a valid username and password.".
         "retry the entry<br>\n";
         echo"<A HREF=\"$PHP_SELF\">Login</A><br>";
         echo " If u are not a member yet,click ".
         "on the following link to register.<br>\n";
         echo "<a href =\"$register_script\">Membership</a>";
    else echo " welcome $username";


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange error Iguchi Visual Studio 2008 1 April 11th, 2008 06:21 AM
An Strange Error alirezaaali Classic ASP Professional 1 August 16th, 2007 10:03 AM
Strange ERROR (?) myself Classic ASP Basics 16 June 22nd, 2006 06:39 AM
Strange Error !!! NinaWilliam ASP.NET 1.0 and 1.1 Basics 2 May 21st, 2006 01:34 AM
Strange error eraser Classic ASP Basics 3 September 21st, 2004 07:55 AM

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