4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Help with PHP code
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
PunkGo
Junior WebHelper
Junior WebHelper


Joined: 06 Aug 2003
Posts: 1

PostPosted: Wed Aug 06, 2003 11:46 pm (14 years, 4 months ago) Reply with QuoteBack to Top

Hey, I dunno what's wrong, but here's what the error says:
Code:
Parse error: parse error, unexpected '{' in c:\appserv\www\login.php on line 17


Here's my PHP:
Code:
if ($submit = "Login")
{

mysql_connect("JOEYOWNZ", "punkgo", "********") or
die ("Could not connect to database");

mysql_select_db("users") or
dir ("Could not select database");

$_REQUEST=mysql_query("select * from user where username='" . $username . "'")
or die ("cant do it");

while ($row=mysql_fetch_array($_REQUEST)) {
if ( isset( $_POST[ 'password' ] )
{
printf("Successfully Logged In!");
}else{
print("Nope");

}
}
}
?>
OfflineView User's ProfileFind all posts by PunkGoSend Personal MessageAOL Instant Messenger
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Thu Aug 07, 2003 7:17 am (14 years, 4 months ago) Reply with QuoteBack to Top

Couple of things highlighted below = should be ==
and dir should be die

see if that helps

Quote:
if ($submit = "Login")
{
mysql_connect("JOEYOWNZ", "punkgo", "********") or
die ("Could not connect to database");

mysql_select_db("users") or
dir ("Could not select database");

$_REQUEST = mysql_query("select * from user where username='" . $username . "'")
or die ("cant do it");

while ($row=mysql_fetch_array($_REQUEST))
{
if ( isset( $_POST[ 'password' ] )
{
printf("Successfully Logged In!");
}
else
{
print("Nope");
}
}
}
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Thu Aug 07, 2003 2:22 pm (14 years, 4 months ago) Reply with QuoteBack to Top

in addition to what Darren said, you should correct the following:
Code:
if ( isset( $_POST[ 'password' ] )

should be
Code:
if ( isset( $_POST[ 'password' ] ) )

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Thu Aug 07, 2003 2:58 pm (14 years, 4 months ago) Reply with QuoteBack to Top

well spotted Very Happy
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
jayant
Team Member



Joined: 07 Jan 2002
Posts: 262
Location: New Delhi, India

PostPosted: Fri Aug 08, 2003 3:06 pm (14 years, 4 months ago) Reply with QuoteBack to Top

Code:
$_REQUEST = mysql_query("select * from user where username='" . $username . "'")
or die ("cant do it");

$_REQUEST is a special array. you should not change information contained in it by assigning it some other values.

________________________________
Jayant Kumar
Member of the 4WebHelp Team
Nibble Guru - Computing Queries Demystified
GZip/ Page Compression Test
OfflineView User's ProfileFind all posts by jayantSend Personal MessageVisit Poster's WebsiteYahoo MessengerMSN Messenger
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.059646 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme