unexpected T_STRING

I am trying to run a *.php file and keep getting this error:

Parse error: parse error, unexpected T_STRING in /home/lskyeho/public_html/editalbum/script/login.php on line 12

I have tried different things to different parts of the file but nothing works. My searches for how to fix this have been all over the Internet and I have not found like issues that resolve mine. Here is my code:

[php]

<?php $db = mysql_connect("host", "user", "pass"); mysql_select_db("lskyeho_photoalbum", $db); $result = mysql_query("SELECT * FROM album_users ORDER BY user_name", $db); $flag = 0; for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_array($result); if (stripslashes($row['user_name']) == $user_name && stripslashes($row['password']) == $password) { 12 UPDATE album_users SET is_logged_in='Y' WHERE user_name=$user_name; Header('Location: ../edit/index.php?user_name=$user_name'); $flag = 1; $i = mysql_num_rows($result);; } } if ($flag == 0) { Header('Location: ../index.php?error=true'); } ?>

[/php]
MOD EDIT: Added PHP bb code tags
This is the original code except I replace my username and password and added the 12 on line 12.

Can anybody help me?

Also I have experience with other languages (Java C/C++) but am new to php. What is a T_STRING?

If this is your code :
[php]

<?php $db = mysql_connect("host", "user", "pass"); mysql_select_db("lskyeho_photoalbum", $db); $result = mysql_query("SELECT * FROM album_users ORDER BY user_name", $db); $flag = 0; for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_array($result); if (stripslashes($row['user_name']) == $user_name && stripslashes($row['password']) == $password) { UPDATE album_users SET is_logged_in='Y' WHERE user_name=$user_name; Header('Location: ../edit/index.php?user_name=$user_name'); $flag = 1; $i = mysql_num_rows($result);; } } if ($flag == 0) { Header('Location: ../index.php?error=true'); } ?> [/php]

Then part of your problem is that you have a normal UPDATE statement but doing nothing with it. Pehaps you meant:

[php]

<?php $db = mysql_connect("host", "user", "pass"); mysql_select_db("lskyeho_photoalbum", $db); $result = mysql_query("SELECT * FROM album_users ORDER BY user_name", $db); $flag = 0; for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_array($result); if (stripslashes($row['user_name']) == $user_name && stripslashes($row['password']) == $password) { $result = mysql_query("UPDATE album_users SET is_logged_in='Y' WHERE user_name='$user_name'"); Header('Location: ../edit/index.php?user_name=$user_name'); $flag = 1; $i = mysql_num_rows($result);; } } if ($flag == 0) { Header('Location: ../index.php?error=true'); } ?>

[/php]

That seemed to do it. I am getting a different error now that is not related. Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service