I’ve got this code for displaying comments (sorry for my last question).
It’s included like this; all the variables are in another page.
<?php
include("scripts/connect_to_mysql.php");
$tab_kom = "SELECT * FROM komenty WHERE stat_id = '$zdni_id' ORDER BY id DESC LIMIT 30";
$ukaz = '';
$res_kom = mysql_query($tab_kom);
$pocit = mysql_num_rows($res_kom);
if($pocit > 0) {
while($row_kom=mysql_fetch_array($res_kom)) {
$kom_uz_id = $row_kom['uid'];
$kom_text = $row_kom['text'];
$stat_id = $row_kom['stat_id'];
}
$tab_kom_uz = "SELECT * FROM uzivatele WHERE id = '$kom_uz_id' LIMIT 1";
$res_kom_uz = mysql_query($tab_kom_uz);
while($row_kom_uz=mysql_fetch_array($res_kom_uz)){
$kom_uz_ids = $row_kom_uz['id'];
$kom_uz_jm = $row_kom_uz['jmeno'];
}
$ukaz .=' '.$kom_text . ' ';
}else{
$ukaz .= '';
}
?>
I should have two results with the same ID in the variable $zdni_id, but only one is showing.
Do you know why?
Try this