在PHP MySQL中将来自同一个表的同一个索引的一个SQL查询组合起来,但我只是尝试索引名称新闻图像选择表而不是获取此输出视图。
这个输出视图图像到达数据库都是图像但是两个分组视图 它唯一的查询如何抛出
[first image get to databese][1] [third image get to databese][3] [five image get to databese][5] five 7 img ...............
[second image get to databese][2] [fourth image get to databese][4] [six image get to databese][6] six 8 img...............
但我尝试此查询但没有工作
$numrow =0;
$vali=0;
$sql_q = mysqli_query($conn,"SELECT * FROM tbl_news where cat_id='$cat_id' and cat_id !=19 order by nid DESC");
$ny = mysqli_fetch_array($sql_q);
if mysqli_num_rows($sql_q) > 0) {
while($newsRowi = mysqli_fetch_array($sql_q)){
$row[]=$newsRowi;
}
$n=0;$val=0;
foreach($row as $newsRow ){
$news_img = $newsRow['news_image'];
$f_id = $newsRow['nid'];
$news_heading = substr($newsRow['news_heading'],0,50);
$sq = mysqli_query($conn,"SELECT * FROM tbl_news where nid='ny[0]'");
$ya=mysqli_fetch_array($sq);
$val = $ya['news_image'];
$n++;
$n++;
}
?>
请帮帮我