The14thGOD Posted January 27, 2007 Share Posted January 27, 2007 Hey, I'm working on my site and I cant seem to find the problem of:Parse error: parse error, unexpected $ in testpage.php on line 187here is the code that I added when i started seeing the problem:[code] <?php //Select comments table and see if there are any related to this art piece //Put table/id in form MYSQL can read $select_table = "art_$art_type"; $select_table .= "_comments"; $select_id = "$id"; $select_id .= "_id"; $com_query = "SELECT * FROM $select_table WHERE id='$select_id' AND status='enabled' "; $com_result = mysql_query($com_query); while($com_row = mysql_fetch_array($com_result)) { echo("<div id=\"comment\"> \n"); //obtain username/avatar $select_user = "SELECT username,avatar,signature FROM user WHERE id='$com_row[user_id]' "; $select_result = mysql_query($select_user); $select_row = mysql_fetch_array($select_result); echo("<h2>$select_row[username]</h2> \n"); echo("<div id=\"section_a\"> \n"); echo("<img src=\"$select_row[avatar]\" alt=\"$select_row[username] avatar\" width=\"82\" height=\"82\" /></div> \n"); echo("<div id=\"section_b\" > \n"); echo("<p class=\"small_text_10\">Posted: $com_row[date]<span class=\"align_right\"><a href=\"edit_com.php\">Edit</a> | <a href=\"delete_com.php\">Delete</a></span></p> \n"); echo("<p class=\"borders\">$com_row[body]</p> \n"); echo("<p class=\"small_text_10\">$select_row[signature]</p></div> \n"); echo("</div> \n"); ?>[/code]I've looked for a while now and I've found some minor syntax errors but fixed those and it still seems to be giving me the problem. I've narrowed it down to this code also, I took out the code and it worked fine.Thanks in advance for any help. Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/ Share on other sites More sharing options...
trq Posted January 27, 2007 Share Posted January 27, 2007 There is nothing obviously wrong with your code. Mind showing us which is line 187? Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/#findComment-170381 Share on other sites More sharing options...
The14thGOD Posted January 27, 2007 Author Share Posted January 27, 2007 It's the end of the document. Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/#findComment-170386 Share on other sites More sharing options...
trq Posted January 27, 2007 Share Posted January 27, 2007 Nope. Still nothing obvious. You realise that echo does not need its arguments wrapped in ( ) ? And also that complex variables should be wrapped within { } when within a double quotes string. eg;[code=php:0]echo("<h2>$select_row[username]</h2> \n");[/code]Should be....[code=php:0]echo "<h2>{$select_row['username']}</h2>\n";[/code] Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/#findComment-170389 Share on other sites More sharing options...
The14thGOD Posted January 27, 2007 Author Share Posted January 27, 2007 Nope, I didn't know that. Just the way I was taught ^_^ Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/#findComment-170390 Share on other sites More sharing options...
Jessica Posted January 27, 2007 Share Posted January 27, 2007 You never close your while{} Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/#findComment-170391 Share on other sites More sharing options...
The14thGOD Posted January 27, 2007 Author Share Posted January 27, 2007 doh *hits self* wow..can't believe I missed that one lol.thanks :D Link to comment https://forums.phpfreaks.com/topic/35926-solved-syntax-parse-error-help/#findComment-170392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.