What I want to do is display some data from the mysql database if it is installed by the user and if it is not installed, I just want to display some placeholder or "dummy" data. For example, if a user creates a profile, he will by default receive some random image or placeholder image as a profile image, and when he changes it, I want to display this image from the database. The same can be said about the userβs description or about me.
This is what I got so far
<?php
$getInfo = $con->prepare("SELECT * FROM user_info WHERE userid=:userid");
$getInfo->execute(array(':userid'=>$userID));
$data = $getInfo->fetch(PDO::FETCH_ASSOC);
$description = $data['description'];
?>
<div class="container">
<div class="row">
<div class="col-sm-12">
<h3 class="page-title">USER DESCRIPTION</h3>
<?php if(!empty($description)) {
echo '<p>' . $description . '</p>';
} else { ?>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur incidunt, at error. Provident veritatis ratione laborum modi laudantium, quidem inventore facilis at qui blanditiis, sunt tempore labore sit, eligendi libero?</p>
<?php } ?>
</div>
</div>
</div>
, !empty($description)
, , , . mysql php, puropses. $userID
- , , .