<?php
include("head.php");
include("config.php");
$username = $_GET['username'];
$query = "SELECT content,video,image,link FROM posts WHERE username = '".$username."' ORDER BY 'posts' . 'post_id' DESC LIMIT 1";
$result = mysql_query($query) or die(mysql_error());
list($content,$video,$image,$link) = mysql_fetch_row($result);
echo '<font size="+4">'.$content.'</font><br />';
if(empty($video)){
echo '';
}else{
echo '<a href="'.$video.'"><img src="/graphics/television.png" border="0"></a>';
}
if(empty($image)){
echo '';
}else{
echo '<a href="'.$image.'"><img src="/graphics/image.png" border="0"></a>';
}
if(empty($link)){
echo '';
}else{
echo '<a href="'.$link.'"><img src="/graphics/link.png" border="0"></a>';
}
?>
<table>
<tr>
<td>
<?
$query = "SELECT content,video,image,link FROM posts WHERE username = '".$username."' ORDER BY 'posts' . 'post_id' DESC";
$result = mysql_query($query) or die(mysql_error());
while(list($content,$video,$image,$link) = mysql_fetch_row($result)){
echo '<center>
<table width="400" bgcolor="lightgrey"><tr><td>'.$username.'</td><td>'.$content.'</td><td>';
if(empty($video)){
echo '';
}else{
echo '<a href="'.$video.'"><img src="/graphics/television.png" border="0"></a><br />';
}
if(empty($image)){
echo '';
}else{
echo '<a href="'.$image.'"><img src="/graphics/image.png" border="0"></a><br />';
}
if(empty($link)){
echo '';
}else{
echo '<a href="'.$link.'"><img src="/graphics/link.png" border="0"></a><br />';
}
echo '</td></tr></table><br />
</center>
';
}
?>
<?
include("foot.php");
?>
This is a the code for my page that displays all the posts from a certain user. First before i put modified the code a bit. It used to show the posts but at a normal order even though DESC was there. Now I added this code and it shows:
http://medialife.latestdot.net/myline.php?username=zcollvee
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 '. 'post_id' DESC LIMIT 1' at line 1