php - 在我的 mysql 表中,在一个单元格中有行,我有数组。如何选择具有特定数组值的行?
问题描述
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 } ?>
解决方案
推荐阅读
- c# - 传递给 SSRS 报告多个整数值
- android - 两个给定日期之间的进度条 - Android Studio
- python - 为什么我的 for 循环中的 for 循环会导致问题?
- android - Android Chrome 中的黑屏和引导选项卡中的视频
- flutter - 带有 StateFull 小部件的 Flutter WorkManager 后台获取示例
- amazon-web-services - 在 aws-sam 环境变量中添加字典
- php - L8 - HTTP 并发请求 - 混淆动态构建关闭
- php - 按用户角色和订单历史记录在 WooCommerce 中设置最低订单金额
- scala - 具有分组查询的 Scala 光滑连接表
- java - arraycopy:元素类型不匹配:无法将 java.lang.Object[] 转换为 java.lang.reflect.Array