0

I am working on a personal project (as a beginner). I am try to copy and paste a value from a MySQL table into a div (like age, class, etc) using SESSION['username'] and SESSION['age'] and so on but I soon realized that only the first one: SESSION['username'] worked because it was entered directly at the point of login.

How can I display a single value from a MySQL and have them pasted in various relevant divs, using PHP?

To clarify, if a div goes like <div><strong> SMS Credit balance:</strong> [Credit balance goes here]</div>

How can I do this with PHP please (in the homepage where the user is redirected to upon login)?

Here is what I did

<?php include(db-config.php);
session_start();
require_once __DIR__ . "/login.php";
$_SESSION['smsbalance'] = $result->mbalance;
$_SESSION['callbalance'] = $result->callbalance;
$_SESSION['avdbalance'] = $result->avbalance;
?>

Then I went to use: <?php echo $_SESSION['smsbalance']?> inside the various DIVs but they do not work.

I am a novice at this, please help. Thanks....

0 Answers0