Hello guys I am getting crazy with this code, I need to fetch the data to php,displaying the records that I have already created in the following Myadminphpm0
I am fetching data from mysql to a page, i am not sure if the way im doing it is appropiate. I am having trouble with fetching values into sections of the page.[
TECHNO TABLE]1
THE CONEXION
<?php
$server_name ='localhost';
$db_user_name ='cl11-l2cert';
$db_password ='4RT!BBDUx';
$db_name ='cl11-l2cert';
$mysql= mysqli_connect($server_name, $db_user_name, $db_password, $db_name);
// Check connection
if (!$mysql) {
die("Connection failed:");
}
//echo "Connected successfully";
?>
AND THIS IS THE CODE FROM THE TECHNO RECORDS LIST
<html>
<body><br><br>
<?php
include_once("conexion.php");
$sql = ' SELECT * FROM `techno`';
$result=mysqli_query($mysql,$sql);
$techno=[];
if (mysqli_num_rows($result) > 0) {
$techno = mysqli_fetch_all($result,MYSQLI_ASSOC);
}
?>
<div class="w3-row">
<div class="w3-threequarter">
<div class="w3-row-padding w3-center w3-margin-top">
<?php
foreach($techno as $x){
?>
<div class="w3-third">
<div class="w3-card w3-container" style="min-height:460px">
<div class="w3-row">
<div class="w3-half">
<p>Id:<?php echo $x['t_id']; ?></p>
<p>Vynil:<?php echo $x['t_vynil']; ?></p>
<p>Price:<?php echo $x['t_price']; ?></p>
<img src="acid.><?php $x['t_img'] ?>.jpg" alt="image" width="50%">
</div>
</div>
</div>
</div>
<?php }
?>
</div>
</div>
</div>
</div>
</body>
</html>