waiwai933 Posted November 15, 2008 Share Posted November 15, 2008 Hi. I'm experiencing some problems with the following code, which is outputting a "Parse error: syntax error, unexpected '{' in /blablabla/example.php on line 13" <?php include("../example.org/header.html"); ?> <h1 align="left"> Main Content </h1> <p align="left"><?php $hostname = "databases.example.org"; $username = "bluefire"; $password = "jellybird"; $database = "admin"; $link = mysql_connect($hostname,$username,$password); mysql_select_db($database) or die("Unable to select database"); $query = "SELECT username FROM authentication WHERE authorized is (1)"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result) { echo $row['value']; } ?> <?php include("../example.org/footer.html"); ?> I have, of course changed some of the authentication details to prevent hacking. Quote Link to comment https://forums.phpfreaks.com/topic/132884-solved-parse-error-unexpected/ Share on other sites More sharing options...
AndyB Posted November 15, 2008 Share Posted November 15, 2008 while ($row = mysql_fetch_assoc($result) s/b while ($row = mysql_fetch_assoc($result)) Quote Link to comment https://forums.phpfreaks.com/topic/132884-solved-parse-error-unexpected/#findComment-690994 Share on other sites More sharing options...
waiwai933 Posted November 15, 2008 Author Share Posted November 15, 2008 Aah, an overlooked parentheses. I think I need glasses. New problem. I fixed that, but now there's a Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /blablabla/example.php on line 12 Quote Link to comment https://forums.phpfreaks.com/topic/132884-solved-parse-error-unexpected/#findComment-690997 Share on other sites More sharing options...
Mchl Posted November 15, 2008 Share Posted November 15, 2008 SELECT username FROM authentication WHERE authorized is (1) Never seen syntax like this before... shouldn''t it be SELECT username FROM authentication WHERE authorized = 1 [edit] According to manual it should be SELECT username FROM authentication WHERE authorized is TRUE Quote Link to comment https://forums.phpfreaks.com/topic/132884-solved-parse-error-unexpected/#findComment-691000 Share on other sites More sharing options...
waiwai933 Posted November 15, 2008 Author Share Posted November 15, 2008 Nope, none of that works. EDIT: Nevermind, I solved the problem. It turns out that I had entered the wrong table name. Quote Link to comment https://forums.phpfreaks.com/topic/132884-solved-parse-error-unexpected/#findComment-691013 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.