и все равно та же ошибка.
$result = mysql_query("(SELECT * FROM `comment_ege`)
UNION
(SELECT * FROM `comment_ccuz`)
ORDER BY `date` DESC LIMIT 3
)") or die(mysql_error());
$result = mysql_query("(SELECT * FROM `comment_ege`)
UNION
(SELECT * FROM `comment_ccuz`)
ORDER BY `date` DESC LIMIT 3");
$result = mysql_query("(SELECT * FROM `comment_ege`)
UNION
(SELECT * FROM `comment_ccuz`)
UNION
(SELECT * FROM `comment`)
ORDER BY `date` DESC LIMIT 4");
Цитата |
можно ли добавить еще одну таблицу в запрос? |
Цитата |
и еще как быть ссылками printf("<a href='post_ccuz.php?id_ccuz=%s'><div class='comment-content2'> |
if(isset($row['cell_table1']))
echo "<a href='".$row['link_table1']."'>anchor</a>";
elseif(isset($row['cell_table2']))
echo "<a href='".$row['link_table2']."'>anchor<a/>";
CREATE TABLE IF NOT EXISTS `comment_cat` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`post` int(5) NOT NULL,
`author` varchar(30) NOT NULL,
`text` text NOT NULL,
`date` varchar(30) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=207 ;
altar comment_cat add link varchar(30) NOT NULL
<div class="corner25">
<h5>Комментарии:</h5>
<div id='cerror'></div>
<form action="#" method="POST" enctype="multipart/form-data" name="addcom" id="addcom" onSubmit="return false" class="sendform">
Ваше имя <input class="comment_name" type="text" name="author" id="author">
<div class="corner20"><textarea name="text"></textarea></div>
<input name="id" type="hidden" value="<?php echo $id; ?>">
<input type='hidden' name='advertisment' value='<?php echo $myrow['title']; ?>'>
<input class="button-small" name="button" type="button" value='Отправить' onclick="doLoad(document.getElementById('addcom'))">
</form>
<div id='resultid'></div>
<!--вывод комментариев -->
<?php
$result = mysql_query("SELECT * FROM comment_cat WHERE post='" . mysql_real_escape_string($id) . "' ORDER BY date DESC, id", $db);
if(mysql_num_rows($result) > 0)
{
$comment = mysql_fetch_array($result);
do
{
$text = $comment["text"];
$author = $comment["author"];
$date = $comment["date"];
printf("<div class='comment-content2'>
<h6>%s</h6>
<p>%s</p>
<p>%s</p>
</div>
",$author,$date,$text);
}
while ($comment = mysql_fetch_array($result));
}
?>