0

Warning: Illegal string offset 'slimg' in /opt/lampp/htdocs/linom/index.php on line 82

<?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));
?>
1
  • 1
    debug using print_r($slider) and check whether $slider array consists of slimg element. Commented Aug 25, 2014 at 14:35

1 Answer 1

2

Your variable names aren't very clear. You accidentally referenced the query string instead of the array:

$sliderV['slimg']

I recommend using better variable names, such as $slider_sql, $slider_query, and $slider.

Sign up to request clarification or add additional context in comments.

1 Comment

faound: i had '$slider['slimg']' instead of '$sliderV["slimg"]'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.