Problems with MySQL

Associate
Joined
21 Mar 2007
Posts
41
Hi,

Can anyone tell me why I keep alternating between an "unexpected T_ENCAPSED_AND_WHITESPACE" error and an "unexpected T_LNUMBER" error with the following code:

$query = "SELECT * FROM boardchanges_checkuser";
$get_comments = mysql_query($query);
while($data = mysql_fetch_array($get_comments))
{
echo("
<table width=\'100%\'>
<tr><td class=\"poll\" align=\"center\"><strong>Comments</strong></td></tr>
<tr><td class=\"poll\" width='25%'>$data['user']</td>
<td class=\"poll\" width='75%>$data['comments']</td><tr>
</table>");
}

I'm trying to insert a table that gives the user number and comments posted by that user.
 
Nope, still getting:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

I can post the whole page's code if it'd help.
 
I think so,

Entire page code:

Code:
<?
include "../bin/global.php";

#check we are logged in...
validateuser(true);

if($isadmin!=true && $isinter!=true){
Header("Location: /index.php");
}

include "../bin/header.php";
?>
<script language="javascript" type="text/javascript">
<!--
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
<table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>


<?


	$poll = mysql_fetch_array(mysql_query("select * from boardchanges_poll"));
	$totalvotes = $poll['totalvotes'];
	$question = $poll['question'];
			
	echo("
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr><td class=\"poll\" align=\"center\">
<strong>Current Standings</strong><br /><br />
</td></tr>
<tr><td class=\"poll\">
");
	
	$get_questions = mysql_query("select * from boardchanges_options");
	while($r=mysql_fetch_array($get_questions)){
	
	
		extract($r);
		$per = $votes * 100 / $totalvotes;
		$per = floor($per);
		
		echo htmlspecialchars($field); 
		?>: <strong><? echo("$votes"); ?></strong><br />
		<div style="background-color: #EEEEEE;"><div style="color: #000000; font-size: 10px; text-align: right;background-color: #CCCCCC; width: <? echo($per); ?>%;"><? echo("$per%"); ?></div></div><br />
		<?
			
	}
	
	echo("
</td></tr>
<tr><td class=\"poll\">
<br /><center>Total votes: <strong>$totalvotes</strong></center>
</td></tr>
</table>");

	$query = "SELECT * FROM boardchanges_checkuser";
	$get_comments = mysql_query($query);
	while($data = mysql_fetch_array($get_comments))
	{
	echo("
<table width=\'100%\'>
<tr><td class=\"poll\" align=\"center\"><strong>Comments</strong></td></tr>
<tr><td class=\"poll\" width=\'25%\'>$data['user']</td>
<td class=\"poll\" width=\'75%\'>$data['comments']</td><tr>
</table>");
}
?>


<?
include "../bin/footer.php";
?>
 
Thanks guys, that's got it to display, even if it does look a bit strange. I've probably got a few missing tags somewhere that the other person I'm working with can find (as they're very good at doing that!)
 
Back
Top Bottom