So I am trying to replicate a simple blogging system I made a month back, But the query no longer works on my new site Here is the code
<?php
function BlogPosts() {
$sql = 'SELECT * FROM "blog-posts" WHERE BlogDeleted = 0';
$value = mysql_query($sql);
if(!$value){
die("<h1>QUERY ERROR IN BLOG_POSTS: </h1>". mysql_error());
}
while($n = mysql_fetch_array($value, MYSQL_ASSOC)){
?>
<h3><?php echo "{$n['BlogTitle']}"; ?></h3>
<p><?php echo "{$n['BlogData']}"; ?></p>
<b class="blog-user"><?php echo "entry by {$n['BlogUser']} on {$n['BlogTime']}"; ?></b>
<?php
}
} //END FUNCTION BlogPosts
?>
The full error is:
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 '"blog-posts" WHERE BlogDeleted = 0' at line 1
EDIT: Fixed the error by adding the ` to blog-posts :)