strago Posted November 4, 2012 Share Posted November 4, 2012 <?php session_start(); ob_start(); mysql_connect("localhost", "root", "XXXXX") or die(mysql_error()); mysql_select_db("XXXXX") or die(mysql_error()); $page_name = $_GET["id"]; $q = mysql_query("SELECT * FROM `memes` WHERE `id` LIKE '$page_name'"); while($result = mysql_fetch_assoc($q){ $db_title = $result["title"]; $db_image = $result["image"]; $db_body = $result["body"]; } echo " <h1>$db_title</h1> <p>$db_image</p> Text: $db_body "; ?> generates Parse error: syntax error, unexpected '{' in /home/site1/public_html/Memes.php on line 10 Line 10 being while($result = mysql_fetch_assoc($q){ I'm trying to use the URL to get the content from the database. filename.php?id=1 Quote Link to comment https://forums.phpfreaks.com/topic/270266-parse-error-syntax-error-unexpected/ Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 Missing the closing parenthesis for the while( . . . Quote Link to comment https://forums.phpfreaks.com/topic/270266-parse-error-syntax-error-unexpected/#findComment-1390051 Share on other sites More sharing options...
strago Posted November 4, 2012 Author Share Posted November 4, 2012 Thanks! Yes, I'm a php n00bie!! Quote Link to comment https://forums.phpfreaks.com/topic/270266-parse-error-syntax-error-unexpected/#findComment-1390053 Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 (edited) Meh, it happens to all of us (nüB). Edited November 4, 2012 by Pikachu2000 Quote Link to comment https://forums.phpfreaks.com/topic/270266-parse-error-syntax-error-unexpected/#findComment-1390054 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.