halfpint Posted September 13, 2008 Share Posted September 13, 2008 Hi I have been trying to fix this for about a week now but I keep getting silly parse errors after I have fixed one it gives me another parse error on a different line. Could somebody please be so kind and go through it and fix the parse errors I now have a parse error on line 58. I am at my wits end with this now lol Thanks <h1>Member List</h1> <table class="text01" border="0" cellspacing="0" cellpadding="0" width=100%> <tr> <th>Status</th> <th>Name</th> <th>Date Joined </th> <th>Plays </th> <th>PM</th> </tr> <br> <?php $limit = 50; $q = mysql_query("SELECT username FROM users WHERE gameplays > 0"); $total_items = mysql_num_rows($q); $total_pages = ceil($total_items / $limit); $page = $_REQUEST['p']; if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) { $page = 1; //default } $set_limit = $page * $limit - ($limit); $timestamp = time(); $timeout = $timestamp-300; // Fix members online $delete = mysql_query("UPDATE users SET status='0' WHERE timestamp<$timeout"); $getinfo = mysql_query("SELECT username,joined,gameplays,status FROM users WHERE gameplays > 0 LIMIT $set_limit, $limit") or die(mysql_error()); while($row = mysql_fetch_array($getinfo)) { ?> <tr> <th ><strong> <?php if($row[status] == '0') { print "<font color=red>Offline</font>"; }elseif($row[status] == '1'){ print "<font color=green>Online</font>"; } ?> </strong></th> <th ><a href="profile-<?=$row[username]?>.html"> <?=$row[username]?> </a></th> <th ><?=$row[joined]?></th> <th ><?=$row[gameplays]?></th> <th ><a href="page.php?page=pms&compose=1&to=<?=$row[username]?>">PM Me</a><br></th> </tr> <tr> <th colspan="5"> <?php } $prev_page = $page - 1; if($prev_page >= 1) { echo "<a href=\"page.php?page=memberlist&p=$prev_page\">< Prev></a>"; } for($a = 1; $a <= $total_pages; $a++) { if($a == $page) { echo("<b> $a</b> | "); //no link } else { echo "<a href=\"page.php?page=memberlist&p=$a"> $a </a>"; } } $next_page = $page + 1; if($next_page <= $total_pages) { echo "<a href=\"page.php?page=memberlist&p=$next_page"><Next></a>"; } ?> </table> <br><br><br><br><br><br><br><br><br><br> Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/ Share on other sites More sharing options...
wildteen88 Posted September 13, 2008 Share Posted September 13, 2008 You're not escaping quotes within your strings, When you start a string with double quotes (") you must escape any double quotes within the string (\"), eg echo "<a href=\"link.html\">Link</a>"; The same applies if you start a string with single quotes too, this time you escape any single quotes within the string. echo '<a href=\'link.html\'>Link</a>'; Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640727 Share on other sites More sharing options...
halfpint Posted September 13, 2008 Author Share Posted September 13, 2008 You're not escaping quotes within your strings, When you start a string with double quotes (") you must escape any double quotes within the string (\"), eg echo "<a href=\"link.html\">Link</a>"; The same applies if you start a string with single quotes too, this time you escape any single quotes within the string. echo '<a href=\'link.html\'>Link</a>'; Hi thanks so this echo "<a href=\"page.php?page=memberlist&p=$a"> $a </a>"; should be cho "<a href=\"page.php?page=memberlist&p=$a\"> $a </a>"; Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640742 Share on other sites More sharing options...
wildteen88 Posted September 13, 2008 Share Posted September 13, 2008 Correct. Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640744 Share on other sites More sharing options...
halfpint Posted September 13, 2008 Author Share Posted September 13, 2008 Ok thankyou very much for your help Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640746 Share on other sites More sharing options...
halfpint Posted September 13, 2008 Author Share Posted September 13, 2008 Oh no now I am getting this parse error from a page that links to the top code (Parse error: syntax error, unexpected T_LNUMBER on line 20) I have no idea what it means as on line 20 there is a space <br> Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640761 Share on other sites More sharing options...
halfpint Posted September 13, 2008 Author Share Posted September 13, 2008 sorry double post Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640762 Share on other sites More sharing options...
wildteen88 Posted September 13, 2008 Share Posted September 13, 2008 Is this on another page? As I do not see <br /> on line 20 in the code above. Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640766 Share on other sites More sharing options...
halfpint Posted September 13, 2008 Author Share Posted September 13, 2008 Is this on another page? As I do not see <br /> on line 20 in the code above. yes it is on another page which links to the top page which I posted above <div align=left><?php $getinfo = mysql_query("SELECT username,email,gameplays,avatar,comments,location,gender,favgame,joined,im,status,id FROM users WHERE username='$_REQUEST[user]'") or die(mysql_error()); $get = @mysql_fetch_array($getinfo); if(@mysql_num_rows($getinfo) == '0') { ?> <h1>No User To View Profile</h1> <br> <br> <?php }else{ ?> <?php echo"$top_games";?> <?php echo"$latest_games";?> <?php echo"$affiliates";?> <br> <h1> <?=$_REQUEST[user]?> 's Profile</h1> <br> <br> <?php if($get[avatar] == '') { print "<img src=http://$site_url/avatars/non.gif width="80" height="80">"; }else{ print "<img src=$get[avatar] width="80" height="80">"; } ?> <br> <br> <strong> <?php if($get[status] == '0') { print "<font color=red>I am currently offline</font>"; }elseif($get[status] == '1'){ print "<font color=green>I am currently online</font>"; } ?> </strong><br> <strong>Total Plays:</strong> </h3> <?=$get[gameplays]?> <br> <br> <strong>Location:</strong> </h3> <?=$get[location]?> <br> <br> <strong>IM:</strong> </h3> <?=$get[im]?> <br> <br> <strong>Gender:</strong> </h3> <?=$get[gender]?> <br> <br> <strong>Favorite Game:</strong> </h3> <?=$get[favgame]?> <br> <br> <strong>Date Joined:</strong> <?=$get[joined]?> <br> <br> <strong>Comments:</strong> <?php $comments = stripslashes($get[comments]); print wordwrap($comments); ?><br> <br> <a href="page.php?page=pms&compose=1&to=<?=$_REQUEST[user]?>">Send this user a PM</a><br> <br> <br> <br> <center> <?php if ($adult ==1 || $porn_setting==1){ include("cache/ad-1-468x60.php"); } else{ include("cache/ad-0-468x60.php"); } ?> </center> <?php $query4 = "SELECT gid,gname FROM favoritegames WHERE uid='$_REQUEST[user]'"; $result4 = mysql_query($query4) or die(mysql_error()); if(@mysql_num_rows($result4) == '0') { }else{ ?> <h1>My Favorite Games:</h1> <?php while (list ($id, $name) = mysql_fetch_row($result4)) { echo "<br><a href=./play.php?action=play&id=$id>$name</a>"; } } ?> <?php } ?> <br><br><br><br><br><br><br><br><br><br> </div> Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640769 Share on other sites More sharing options...
wildteen88 Posted September 14, 2008 Share Posted September 14, 2008 Again its the same issue, you're not escaping your quotes within strings. You should go through your code and ensure you have escaped your quotes correctly. Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-640989 Share on other sites More sharing options...
halfpint Posted September 14, 2008 Author Share Posted September 14, 2008 Again its the same issue, you're not escaping your quotes within strings. You should go through your code and ensure you have escaped your quotes correctly. Hi ok thanks for your help, I did not write this script I purchased it and when I try and get help from the person I bought it from they just dont reply. I am not a php coder I only know tiny bits which I have picked up over time. Thanks again for your help I will go over it and look for the quotes within the strings as you mentioned above. Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-641003 Share on other sites More sharing options...
halfpint Posted September 14, 2008 Author Share Posted September 14, 2008 Is this correct, sorry Im a bit dumbfounded on this one print "<img src=http://$site_url/avatars/non.gif width="80" height="80">"; should be print "<img src=http://$site_url/avatars/non.gif width="80" height="80">/"; Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-641009 Share on other sites More sharing options...
wildteen88 Posted September 14, 2008 Share Posted September 14, 2008 No just escape all double quotes within the string except for the first and last quote, example print "<img src=http://$site_url/avatars/non.gif width="80" height="80">"; Escape all the quotes highlighted in blue. Do not escape the quotes in red. TO escape you place a backslash in front of the quote like so \" or \' Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-641011 Share on other sites More sharing options...
halfpint Posted September 14, 2008 Author Share Posted September 14, 2008 No just escape all double quotes within the string except for the first and last quote, example print "<img src=http://$site_url/avatars/non.gif width="80" height="80">"; Escape all the quotes highlighted in blue. Do not escape the quotes in red. TO escape you place a backslash in front of the quote like so \" or \' Ok thank you once again for your help Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-641012 Share on other sites More sharing options...
Mchl Posted September 14, 2008 Share Posted September 14, 2008 print "<img src="http://$site_url/avatars/non.gif" width="80" height="80">"; Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-641013 Share on other sites More sharing options...
halfpint Posted September 14, 2008 Author Share Posted September 14, 2008 thanks for your help guys it worked Quote Link to comment https://forums.phpfreaks.com/topic/124109-keep-getting-parsing-errors/#findComment-641017 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.