1

postCategory column having an arrays like

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

//So please tell me how to select data

<?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 } ?>    
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
srikanth
  • 11
  • 2

0 Answers0