php - Two LIKE concate with Two Limits in sql -
i fetching data server this:
$con = mysqli_connect($servername, $username, $password, $dbname); $sql2 = "select * story category concat('%' ,'worldlist', '%') order idstory desc limit 20"; $result2 = mysqli_query($conn, $sql2); mysqli_query ($con,"set character_set_results='utf8'"); while($finalresult=mysqli_fetch_assoc($result2)){}
now want data of category :
$conn = mysqli_connect($servername, $username, $password, $dbname); $sql2 = "select * story category concat('%' ,'worldlist', '%') order idstory desc limit 20 , concat('%' ,'worldtop', '%') order idstory desc limit 1,20"; $result2 = mysqli_query($conn, $sql2); mysqli_query ($conn,"set character_set_results='utf8'"); while($finalresult=mysqli_fetch_assoc($result2)){}
i know wrong not query how can make possible this.ps: new in php
use sql union
select * story category concat('%' ,'worldlist', '%') limit 20 union select * story category concat('%' ,'worldtop', '%') order idstory desc limit 20
Comments
Post a Comment