echo image according to a condition

前端 未结 1 1830
耶瑟儿~
耶瑟儿~ 2021-01-17 06:42

I have an HTML tag here :


    
1条回答
  •  既然无缘
    2021-01-17 07:34

    The output from your code was putting tags inside the src attribute of the tag.
    That by definition doesn't work in HTML. If everything else was right, this should work:

     0 ) {
            $array = array_splice($array, 0, $limit);
        }
        return $array;
    }
    
    function render_images() {
        global $stmt3;
        $output = '';
    
        if ($count = sqlsrv_num_rows($stmt3) > 0) {
            while ($recentBadge = sqlsrv_fetch_array($stmt3)) {
                $result[] = $recentBadge;
            }
    
            if ($count > 3) {
                $result = get_random_elements(result, 3);
            }
    
            foreach ($result as $recentBadge) {
                $output .= $recentBadge['BadgeName'];
                $output .= '';
                $output .= '
    '; } } else { $output = 'no results'; } return $output; } ?>

    As a tip: please try to keep your code separated, the logic separated from the view.

    0 讨论(0)
提交回复
热议问题