Unexpected Bracket?
Posted: Fri Dec 12, 2008 3:23 am
I am getting the error:
Parse error: syntax error, unexpected ')' in /home/beachh/public_html/test.php on line 141
But in my code all of the brackets seem to match / be valid :
The error is pointing to foreach ($post = mysql_fetch_object($result)) { but to me this seems syntactically correct? Am I missing something?
Parse error: syntax error, unexpected ')' in /home/beachh/public_html/test.php on line 141
But in my code all of the brackets seem to match / be valid :
Code: Select all
<?php
$query = ("
SELECT
post_date,
post_title,
post_content,
guid
FROM
`wp_posts`
ORDER BY
post_date DESC
LIMIT
0,5");
$result = mysql_query($query);
foreach ($post = mysql_fetch_object($result)) {
?>
<div class="post">
<div class="post_title">
<a href="<?= $post->guid ?>"><?= $post->post_title ?><span class="pdate"><?= $post->post_date ?></span></a>
</div>
<div class="post_content"><?= $post->post_content ?></div>
</div>
<?
}
?>