PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
a94060
Forum Regular
Posts: 543 Joined: Fri Feb 10, 2006 4:53 pm
Post
by a94060 » Wed May 31, 2006 8:47 pm
Hi all ,i spent some time baking in front of my CRT and keep on getting this error:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/noob/public_html/admin/tabview.php on line 34
I read almost all concat guides and cant seem to find problem(i know its simpe for you all) HEre it is:
Code: Select all
echo '<table cellspacing=\"7\">';
echo '<th>Offer Name</th>';
echo'<th>User completing Offer</th>';
echo'<th>Complete?</th>';
while($array = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo '<tr>' .$array['offer_name']</tr>;//THIS IS LINE 34!!!!!!!!!!!!!!!!!!!!!
echo '<tr>' .$array['username']</tr>;
echo '<tr><a href=do.php?act=approve&entry='.$array['id']>Approve</a></tr>;//the link which allows us to approve the entry
}
echo '</table>';//closes the dynamic table
echo '<br>';
echo '<hr>'; //hrozontial rule
echo 'Here are the offers that are completed:';
$query = "SELECT * FROM coffers"
$result = mysql_query($query);
$hits = mysql_num_rows($result);
It must be a simple problem with concat or maybe something else i have done wrong( i think im trying to hard).
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Wed May 31, 2006 8:59 pm
Perhaps you should broast yourself instead:
Code: Select all
echo '<tr>' . $array['offer_name'] . '</tr>';//THIS IS LINE 34!!!!!!!!!!!!!!!!!!!!!
echo '<tr>' . $array['username'] . '</tr>';
(#10850)
ambivalent
Forum Contributor
Posts: 173 Joined: Thu Apr 14, 2005 8:58 pm
Location: Toronto, ON
Post
by ambivalent » Wed May 31, 2006 9:00 pm
Errors on the following lines:
Code: Select all
echo'<th>User completing Offer</th>'; // need space between ' and echo
echo'<th>Complete?</th>'; //ditto
echo '<tr>' .$array['offer_name']</tr>; //didn't close quotes or concat properly
echo '<tr>' .$array['username']</tr>; //ditto
echo '<tr><a href=do.php?act=approve&entry='.$array['id']>Approve</a></tr>; //ditto
echo '<tr>'.$array['offer_name'].'</tr>' //correct concat
a94060 wrote:
I read almost all concat guides and cant seem to find problem
Use a text editor with syntax highlighting so that errors like this becomes more obvious.
a94060
Forum Regular
Posts: 543 Joined: Fri Feb 10, 2006 4:53 pm
Post
by a94060 » Thu Jun 01, 2006 12:08 pm
i used dreamweaver,maybe it does not highlight the problems in there?
Perhaps you should broast yourself instead:
Code: Select all
:
echo '<tr>' . $array['offer_name'] . '</tr>';//THIS IS LINE 34!!!!!!!!!!!!!!!!!!!!!
echo '<tr>' . $array['username'] . '</tr>';
i had put this here so you guys would know which line is 34, i put the ! so u might be able to find it easly should u need to.
[/quote]
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Thu Jun 01, 2006 1:05 pm
Code: Select all
<?php
echo '<table cellspacing="7">';
echo '<th>Offer Name</th>';
echo '<th>User completing Offer</th>';
echo '<th>Complete?</th>';
while ($array = mysql_fetch_array($result,MYSQL_ASSOC))
{
echo '<tr>' . $array['offer_name'] . '</tr>';
echo '<tr>' . $array['username'] . '</tr>';
echo '<tr><a href="do.php?act=approve&entry=' . $array['id'] . '">Approve</a></tr>';
}
echo '</table>';
echo '<br />';
echo '<hr />';
echo 'Here are the offers that are completed:';
$query = "SELECT * FROM coffers";
$result = mysql_query($query) or die("Could not get the data: " . mysql_error());
$hits = mysql_num_rows($result);
?>
a94060
Forum Regular
Posts: 543 Joined: Fri Feb 10, 2006 4:53 pm
Post
by a94060 » Thu Jun 01, 2006 5:28 pm
thanks man