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. 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)) 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 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 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. Link to comment https://forums.phpfreaks.com/topic/132884-solved-parse-error-unexpected/#findComment-691013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.