What i want to do is to display some data from mysql database if its set by user and if it not set then i just want to display some placeholder or "dummy" data. For example if user create profile he will by default get some random or placeholder picture as profile picture and when he change it i want to display that picture from database. Same goes for lets say user description or 'about me' section.
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>
So here i am using !empty($description)
but i am not sure if this is right way to do this and if this is always going to work. I am new to mysql and php and this is just for learning puropses. And just to add $userID
is session that exists if user is logged in.