$tab_content .= ' <?php if ($rownewsall['menu_type_id'] == '1') { <a href="detail.php?id_list='.$sub_row["id_list"].'&aNum='.$sub_row["b_num"].'" > <img width="100%" src="upload/news/cover/'.$sub_row["fileload5"].'" class="rounded" alt=""> </a> if ($rownewsall['menu_type_id'] == '2') { <a href="upload/news/'.$sub_row["file1"].'" > <img width="100%" src="upload/news/cover/'.$sub_row["fileload5"].'" class="rounded" alt=""> </a> '; } ?>
var_dump($rownewsall);
<?php $stmnewstab = $conn->prepare("SELECT * FROM catfile WHERE show=:show ORDER BY idtype ASC "); $stmnewstab->execute( array(':h_show' => "Y") ); $stmnewstab->execute(); $tab_menu = ''; $tab_content = ''; $i = 0; while($rowtab = $stmnewstab->fetch(PDO::FETCH_ASSOC)) { $idtype=$rowtab['idtype']; if($i == 0) { $tab_menu .= ' <li class="active "><a href="#'.$rowtab["idtype"].'" data-toggle="tab">'.$rowtab["cat_name"].'</a></li> '; $tab_content .= ' <div id="'.$rowtab["idtype"].'" class="tab-pane fade in active"> '; } else { $tab_menu .= ' <li><a href="#'.$rowtab["idtype"].'" data-toggle="tab">'.$rowtab["cat_name"].'</a></li> '; $tab_content .= ' <div id="'.$rowtab["idtype"].'" class="tab-pane fade"> '; } $stm = $conn->prepare("SELECT * FROM filelist WHERE idtype=:idtype AND h_show=:h_show "); $stm->execute( array(':idtype' => "$idtype" ,':h_show' => "Y") ); $stm->execute(); while($rownewsall= $stm->fetch(PDO::FETCH_ASSOC)) { $tab_content .= ' <div class="col-md-3" style="margin-bottom:36px;"> <?php // link ไปหน้ารายละเอียด if ($rownewsall["type_id"] == "1") {?> <img width="100%" src="file/'.$rownewsall["fileload5"].'" class="rounded" alt=""> <?php } ?> <?php // link ไปไฟล์เอกสาร .pdf } if ($rownewsall["type_id"] == "2") {?> <a href="upload/news/'.$rownewsall["file1"].'" > <?php } ?></a> </div> '; } $tab_content .= '<div style="clear:both"></div></div>'; $i++; } ?> <link rel="stylesheet" href="css_js/css/tabbootstrap.min.css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <div class="container"> <ul class="nav nav-tabs"> <?php echo $tab_menu; ?> </ul> <div class="tab-content"> <br /> <?php echo $tab_content; ?> </div> </div>
Quote:The return value of this function on success depends on the fetch type. In all cases, false is returned on failure or if there are no more rows.
$tab_content .= ' <div class="col-md-3" style="margin-bottom:36px;"> <?php if ($rownewsall["type_id"] == "1") {?>
while($rownewsall= $stm->fetch(PDO::FETCH_ASSOC)) { $tab_content .= ' <div class="col-md-3" style="margin-bottom:36px;">'; // link ไปหน้ารายละเอียด if ($rownewsall["type_id"] == "1") { $tab_content .= '<img width="100%" src="file/'.$rownewsall["fileload5"].'" class="rounded" alt="">'; } // link ไปไฟล์เอกสาร .pdf if ($rownewsall["type_id"] == "2") { $tab_content .= '<a href="upload/news/'.$rownewsall["file1"].'" >'; } $tab_content .= '</a> </div> '; }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง