syntax error in blog get posts script
Posted: Wed Jun 27, 2007 2:42 pm
I am making a blog type thing and I am trying to get the posts. I user this code:
and I get this error message:
Code: Select all
<?php
include 'session.php';
include 'dbconnect_silent.php';
$username = $user;
$sql = MYSQL_QUERY("SELECT * from dailyvibe WHERE userlink='$username' ORDER BY postid DESC")
or die ("You have not made any Dig posts yet.");
$result = mysql_query($sql) or print ("Can't select entry from table php_blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$date = date("l F d Y", $row['timestamp']);
$title = stripslashes($row['title']);
$entry = stripslashes($row['entry']);
?>
<p><strong><?php echo $title; ?></strong><br /><br />
<?php echo $entry; ?><br /><br />
Posted on <?php echo $date; ?>
</p>
<?php
}
?>where have I gone wrong?Can't select entry from table php_blog.
Resource id #5
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #5' at line 1