K
K
konohovec2020-05-17 13:29:27
PHP
konohovec, 2020-05-17 13:29:27

Why does PHP code remove site footer?

I'm trying to display data from the database into separate divs, just like in online stores. The problem is that the PHP code for some reason removes the contents of the footer and does not display anything from the database. I give the PHP code itself with the function, and also an example of HTML markup. I hid the name and password from the database)))


This is an example of a code with a function where you need to read data from the database

<?php

$dbhost = "localhost";
$dbname = "";
$dbusername = "";
$password = "";

$mysqli = @new PDO('mysql:host=$dbhost, dbname = $dbname', $password, $dbusername);
function get_wheel12() {
  global $mysqli;
  $wheel12 = $mysqli->query("SELECT * FROM autoobuv_spb");
  return $wheel12;
}
?>


And this is an example of markup in an HTML file.
<?php
include ('test.php')
?>
<?php
$wheel12 = get_wheel12();
foreach ($wheel12 as $wheel12s): ?>

  <div class="element mix diameter<?php echo $wheel12s['Diametr']; ?> width<?php echo $wheel12s['Width']; ?> height<?php echo $wheel12s['Height']; ?> summer <?php echo $wheel12s['Marka']; ?>">
    <div class="images">
      <a href=""><img src="" alt="<?php echo $wheel12s['Marka']; ?>"></a>
    </div>
    <div class="spisok">
      <ul>
        <li><?php echo $wheel12s['Marka']; ?></li>
        <li>Сезон: Лето</li>
        <li>Диаметр: R<?php echo $wheel12s['Diametr']; ?></li>
        <li>Ширина: <?php echo $wheel12s['Width']; ?> мм</li>
        <li>Высота: <?php echo $wheel12s['Height']; ?> мм</li>
        <li>Остаток: 4-5 мм</li>
        <li>Количество: 2 шт.</li>
        <li>Цена: 4000 руб.</li>
      </ul>
    </div>
  </div>

<? endforeach; ?>


Thanks in advance for your replies!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
its2easyy, 2020-05-17
@its2easyy

Somewhere in php there is an error, after which the execution stops and therefore the footer is not displayed. Enable debugging and see errors

X
xmoonlight, 2020-05-17
@xmoonlight

Remove the "@" dog:
@new

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question