在我的mysql表中有一个单元格中的行我有数组。如何选择具有垂直数组值的行?

时间:2018-08-31 08:51:04

标签: php arrays mysqli

postCategory列具有类似的数组

Array
(
    [0] => movie news
    [1] => breaking news
    [2] => political news
)   

//所以请告诉我如何选择数据

<?php

$select_posts = "select * 
                 from blogposts 
                 where postCategory = 'political news' 
                 IN(postCategory) 
                 order by postId DESC 
                 LIMIT 1,6";

$run_posts = mysqli_query($con,$select_posts);

while($row=mysqli_fetch_array($run_posts)){

    $postId = $row['postId']; 
    $postTitle = $row['postTitle'];
    $postContent = $row['postContent'];
    $futureImage = $row['futureImage'];
    $postCategory = $row['postCategory'];
    $postTags = $row['postTags'];
    $postAuthor = $row['postAuthor'];
    $postDate = $row['postDate'];


?>  

    <!--Widget Post-->
    <!--Widget Post-->
    <article class="widget-post" style="padding-left:0px;min-height: 40px;   margin-bottom: 14px;">
        <div class="text" style="">
            <a href="blog-single.php?id=<?php echo $postId; ?>?postTitle=<?php echo str_replace(' ', '-', $postTitle);?>"> <?php echo substr($postTitle,0,60); ?> 
            </a>
        </div>
    </article>
<?php } ?>    

0 个答案:

没有答案