-1
当列具有某些结构时,我如何从更多表中选择查询。所以我想用选择ID,波萨等,从旅游和istorie表变量从更多表中选择具有相同结构的查询
$sql = "SELECT id, titlu, link, poza, alt, keywords FROM istorie WHERE approved='1' LIKE '%''".$keyword."''%'='%''".$keyword."''%' ORDER BY RAND() LIMIT 3" ;
$query = mysqli_query($con, $sql);
if(!$query){
printf("Error: %s\n", mysqli_error($con));
exit();}
$istorielist = '';
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$id = $row["id"];
$titlu = $row["titlu"];
$link = $row["link"];
$poza = $row["poza"];
$alt = $row["alt"];
$istorielist .= '<div id="articol-content-more"><a href="/istorie/'.$link.'"><img src="/images/'.$poza.'.jpg"class="articol-content-more-image" alt="'.$alt.'"><p class="articol-content-more-title">'.$titlu.'</p></a><span><a class="articol-content-more-afla" href="/istorie/'.$link.'">Citește mai multe</a></span><span class="articol-content-more-fl"><div class="fb-share-button" data-layout="button_count" data-href="http://esticurios.ro/istorie/'.$link.'"></div></span></div>';
}
mysqli_free_result($query);
我想还集成了来自工作台行程查询,不仅从表istorie ,两者具有某种结构ID,titlu,链接,波萨,ALT,关键词
在你的查询中使用union all。从t1选择ID union从t2选择ID –
你能给我一个例如的PHP代码?我不知道 –
在这里你有一些例子https://www.techonthenet.com/mysql/union_all.php –