odetron Posted November 23, 2006 Share Posted November 23, 2006 [quote]Parse error: parse error, unexpected T_STRING in /home/www/phimil.freehostia.com/odetronchat/login.php on line 19[/quote]Heres line 19.[code]$query = “select * from users were username=’$username’ and password=’$password'”;[/code]Whats wrong whit this? Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/ Share on other sites More sharing options...
Barand Posted November 23, 2006 Share Posted November 23, 2006 My guess is you forgot the ";" at end of line 18 Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128882 Share on other sites More sharing options...
odetron Posted November 23, 2006 Author Share Posted November 23, 2006 no, I got that.Lines 16-19 (if that helps)[code]session_start();$username = $_POST[‘username’];$password = md5($_POST[‘password’]);$query =“SELECT * from users WHERE username='$username' and password='$password'”;[/code] Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128884 Share on other sites More sharing options...
jawapro Posted November 23, 2006 Share Posted November 23, 2006 If that isnt the problem it could be cause [code]’$password'[/code] has one ’ and one ' which seem to be different.That COULD be a problem.Post the lines around the problem line, to see if the problem is in the ones before it. Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128885 Share on other sites More sharing options...
odetron Posted November 23, 2006 Author Share Posted November 23, 2006 nope. That did nothing. Ill put it up , but I think is was because I typed the wrong mysql sever info down. lol Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128886 Share on other sites More sharing options...
ataria Posted November 23, 2006 Share Posted November 23, 2006 Read my newer post. Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128887 Share on other sites More sharing options...
Barand Posted November 23, 2006 Share Posted November 23, 2006 Your quote characters look weird! Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128888 Share on other sites More sharing options...
odetron Posted November 23, 2006 Author Share Posted November 23, 2006 alright I got it.it had to be changed to[code]$query = mysql_query("SELECT * FROM `users` WHERE `username`='{$username}' `password`='{$password}'");[/code] Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128889 Share on other sites More sharing options...
ataria Posted November 23, 2006 Share Posted November 23, 2006 Alright. I am guessing this is a log-in page with two fileds.. username and password..this is how I would code it.. this is how I would code it..[code]if (isset($_POST['Login'])){ $get_user = mysql_query("SELECT *FROM `users`WHERE `username`='$_POST[username]'"); $count_user = mysql_num_rows($get_user); $user = mysql_fetch_assoc($get_user); $enc_pass = md5(strtolower($_POST['username']) . $_POST['password']); if (empty($_POST['username'])) echo 'You forgot to enter a username.'; elseif (empty($_POST['password'])) echo 'You forgot to enter your password.'; elseif ($count_user == 0) echo 'The username you entered does\'t exist.'; elseif ($enc_pass != $user['password']) echo 'Passwords don\'t match, try again.'; else { the success stuff goes here... }}else {// the form will go here.}[/code]if your gonna add cookies, don't forget your 'ob_start();' and 'ob_flush();' Link to comment https://forums.phpfreaks.com/topic/28178-unexpected-t-string-help/#findComment-128892 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.