Trotterwatch Trotterwatch - 1 year ago 66
PHP Question

Displaying a PHP result

I am trying to learn php together with MYSQL. I have built the database on on the from end I have written the code below to bring in the website title from the database which works. However, I have two questions.

  1. How would I get the result to display in tags?

  2. Is this the cleanest way of pulling this value through?

Any help or advise greatly appreciated

include 'connection.php';

$sql = "SELECT VariableValue FROM VariableValues WHERE VariableID = '1'";
$result = $conn->query($sql);

while($header = $result->fetch_assoc()) {
echo $header["VariableValue"]. "<br>";


Answer Source

You can echo all types of tags in PHP echo for example:

echo '<div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
          <div id="success_alert" align="center" class="alert alert-success">
              <strong>Log in to download this chapter.</strong>

I have echoed different types of bootstrap tags in echo. Similarly you can also echo all types of tags you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download