Answer the question
In order to leave comments, you need to log in
Can't get output in php how to fix it?
Guys can anyone help
I'm trying to make a website and there are a number of problems.
For example, I want to display pictures on the site from the database, I do everything like this
$sql_img = $db->super_query("SELECT * FROM imgtop");
foreach($sql_img as $q)
$img .= '<li style="background-image: url({theme}/img/'.$sql_img['name'].');" class="overlay"></li> ';
$tpl->set('{img}', $img);
<li style="background-image: url(/system_sain/lk_system/system_tpl/komp/img/slider_1.jpg);" class="overlay"></li>
<li style="background-image: url(/system_sain/lk_system/system_tpl/komp/img/slider_1.jpg);" class="overlay"></li>
Answer the question
In order to leave comments, you need to log in
1) you can write what var_dump($sql_img); will display;
2) it is more logical to think that it would be more correct to write instead of $sql_img['name'] -> $q['name']
what does it show?
$sql_img = $db->super_query("SELECT * FROM imgtop limit 2", true); print_r($sql_img); exit;
Outputs an array like this
Array ( [0] => Array ( [id] => 1 [name] => slider_1.jpg ) [1] => Array ( [id] => 2 [name] => slider_2.jpg ) )
sandbox.onlinephpfunctions.com/code/9f43dc6039aa53...
result:
someonepiz... tryndit, and most likely not an interpreter)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question