警告:非法字符串偏移' slimg'在第82行的/opt/lampp/htdocs/linom/index.php
<?php
$slider = "SELECT * FROM post ORDER BY id ASC LIMIT 4";
$slider1 = mysqli_query($connect,$slider);
$sliderV = mysqli_fetch_array($slider1);
do {
printf ("<div class='slider'>
<a href='view.php?id=%s'>
<figure>
<img class='slideimg' src=%s>
<figcaption>
%s
</figcaption>
</figure>
</a>
</div>",$sliderV['id'],$slider['slimg'],$sliderV['title']); //here is error
}
while ($sliderV = mysqli_fetch_array($slider1));
?>
答案 0 :(得分:2)
您的变量名称不是很清楚。您不小心引用了查询字符串而不是数组:
$sliderV['slimg']
我建议使用更好的变量名称,例如$slider_sql
,$slider_query
和$slider
。