alexa-tracking

[ASK]

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/54dd66d5138b46a0448b456c/ask
Breaking News! 
[ASK][PHP]
mau nanya dong gan gmn caranya agar bisa ngelooping menggunakan database postgresql PDO
Quote: <?
if($idd == '0'){
}else{
$idd = $_POST['idus'];

$ids = $db->prepare("SELECT distinct a.id_menu, a.id_sub,b.descr, a.c,a.r,a.u,a.d from t_userMenu a inner join t_menu1 b on a.id_menu = b.id_menu where id = '$idd' order by id_sub");
$ids->execute();
$idds= $ids->rowCount();
if($idds > 0){
$row = $ids->fetch(PDO::FETCH_ASSOC);
}
$idMenu = $row['id_menu'];
$idSub = $row['id_sub'];
$descr = $row['descr'];
$c = $row['c'];
$r = $row['r'];
$u = $row['u'];
$d = $row['d'];
}
if ($idd != '0'){

echo '<td class="view-message ">'.$idMenu.'</td>';
echo '<td class="view-message ">'.$idSub.'</td>';
echo '<td class="view-message dont-show">'.$descr.'</td>';
echo '<td class="view-message dont-show">'.$c.'</td>';
echo '<td class="view-message inbox-small-cells">'.$r.'</td>';
echo '<td class="view-message text-center">'.$u.'</td>';
echo '<td class="view-message text-center">'.$d.'</td>';

}
?>

sebelum nya ane ucapin terimakasih
Kalau begini gimana gan ??
Code:
$idds= $ids->rowCount();
if($idds != 0){
while($idds <= 5) {
$row = $ids->fetch(PDO::FETCH_ASSOC);

echo '<td class="view-message ">'.$row['id_menu'].'</td>';
echo '<td class="view-message ">'.$row['id_sub'].'</td>';
echo '<td class="view-message dont-show">'.$row['descr'].'</td>';
echo '<td class="view-message dont-show">'.$row['c'].'</td>';
echo '<td class="view-message inbox-small-cells">'.$row['r'].'</td>';
echo '<td class="view-message text-center">'.$row['u'].'</td>';
echo '<td class="view-message text-center">'.$row['d'].'</td>';
}
}
}


Dasarnya sih ini
Code:
$x = 1;

while($x <= 5) {
echo "The number is: $x <br>";
$x++;
}


Source w3school

CMIIW, sambil nunggu suhu turun gunung emoticon-Smilie
Code:

if ($idds > 0) while ($row = $ids->fetch(PDO::FETCH_ASSOC)) {
$idMenu = $row['id_menu'];
...
$d = $row['d'];
echo '<td class="view-message ">'.$idMenu.'</td>';
...
echo '<td class="view-message text-center">'.$d.'</td>';
}

[SOLVED]

makasih agan2 yang udah bantuin emoticon-Big Grin