User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,834 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,519 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1528 | Replies: 4
Reply
Join Date: Aug 2006
Posts: 1
Reputation: baysiqq is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
baysiqq baysiqq is offline Offline
Newbie Poster

Please Help! parse error, unexpected T_STRING

  #1  
Aug 20th, 2006
[PHP]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login Processing...</title>
</head>
<body>
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if( $username != null or $password !=null)
{
$conn = @mysql_connect("localhost", "uesrname", "pass") or die("could not connect");

$rs = @mysql_select_db( "siqq_web", $conn ) or die("could not select database");

$sql = "SELECT * from basicinfo where username=\"$username\" and password = password( \"$password\" );
$rs = @mysql_query( $sql, $conn ) or die("could not execute");

$num = mysql_numrows( $rs );

if( $num != 0 )
{
echo( "welcome" );
}
else
{
echo( "no" );
}
}
else
{
echo( "something went wrong." );
}
?>
</body>
</html>[/PHP]

I keep getting "Parse error: parse error, unexpected T_STRING in /home/siqq/public_html/test/login.php on line 18"
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Posts: 1
Reputation: JRX is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
JRX JRX is offline Offline
Newbie Poster

Re: Please Help! parse error, unexpected T_STRING

  #2  
Aug 20th, 2006
The SQL in the line beginning $sql hasn't been terminated with " double quotes
Reply With Quote  
Join Date: Jul 2004
Location: North East Indiana
Posts: 491
Reputation: Puckdropper is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 20
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: Please Help! parse error, unexpected T_STRING

  #3  
Aug 20th, 2006
Thanks for using [ code ] tags.

If you use an editor with color highlighting, it can sometimes help you catch an error such as this. Notice how the text is all red until it hits the quote on the next line?
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote  
Join Date: Aug 2006
Posts: 2
Reputation: blacksmoke is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
blacksmoke's Avatar
blacksmoke blacksmoke is offline Offline
Newbie Poster

Re: Please Help! parse error, unexpected T_STRING

  #4  
Aug 20th, 2006
U forgot u enter '"' double quote without('). look at codes again!
Last edited by blacksmoke : Aug 20th, 2006 at 11:29 pm.
Reply With Quote  
Join Date: Aug 2006
Posts: 2
Reputation: blacksmoke is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
blacksmoke's Avatar
blacksmoke blacksmoke is offline Offline
Newbie Poster

Solution Re: Please Help! parse error, unexpected T_STRING

  #5  
Aug 20th, 2006
Its solved: Let see now!

<?php
//$username = $_POST['username'];
//$password = $_POST['password'];
$username = "user";
$password = "password";
if( $username != null or $password !=null){ // If 1
$conn = @mysql_connect("localhost", "username", "password") or die("could not connect");
$rs = @mysql_select_db( "test", $conn ) or die("could not select database");
$sql = "SELECT * from basicinfo where username=('$username') and password = password( '$password' )"; // Here was problem
$rs = @mysql_query($sql, $conn) or die("could not execute");
$num = mysql_numrows( $rs );
} else {
if ($num != 0){ // If 2
echo( "welcome" );
} elseif ($num <= 0 || $num = null){ // in If 2
echo("no");
} else { // in If 2
echo( "something went wrong." );
} // end if 2
} // end if 1
?>

My Files Here: http://www.geocities.com/waytosuccess4it/index.html
Last edited by blacksmoke : Aug 20th, 2006 at 11:36 pm. Reason: Smoe codes was missing!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 7:25 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC