Tuesday, 9 June 2020

die and exit functions

echo 'hello';
exit (' error');
becaues of exit - second echo will not print ,it will stop at exit only
echo 'vamsi';
die and exit is most useful in server connction
<?php
mysqli connect('localhost', 'root') || die(" cant connct to database");
if the local host conncected to root , it will show as connected or if it is not connceted usind die - it shows it will not connected
echo 'connected';
?>
echo "<bold> vamsi </bold>";
how to apply style s using echo call
<?php
$mycls = 'maindiv';
echo '<style>
using echo we created the class
.mainDiv{ padding: 20px; background-color: black;margin:10px;}
apply styles
</style> ';
?>
<div class="<?php echo $mycls ?>'
box1
</div>
<div class="<?php echo $mycls ?>">
box2
</div>

die or exit



whats is the exit or die, where it will useful
how to apply styles

No comments:

Post a Comment