This is my page from an online radio station site of mine on localhost, it's a basic PHP/MySQL one for test purposes:
<?php
mysql_connect('localhost', 'root', 'mypass') or die (mysql_error());
mysql_select_db('radiotest') or die (mysql_error());
$result = mysql_query("SELECT *, TIME_FORMAT(airtime, '%H:%i') `airtime`
from presenters");
//Table starting tag and header cells
while($row = mysql_fetch_array($result)){
//Display the results in different cells
echo "<dd><dl><img src=' " . $row['image'] . " '>" . $row['airtime'] ."
" . $row['presenter'] . "</dd></dl>";
echo "<dd><dl>" . $row['showinfo'] . "</dd></dl>";
}
?>
It works properly, displays the data from the table in the required format.
However, I want to try doing it this way:
<dd><dl><img src='<?php echo $row['image'] ?'> <?php echo $row['airtime']?>
<?php echo. $row['presenter']?> </dd></dl>
My problem: I admit I've forgotten how to do echo without displaying it in the PHP/MySQL query like above, so how can I ensure it displays the variables using echo without having to declare it in the MySQL connection? I know my original is correctly formatted, but I don't want it to have the echo variables after the while part of the syntax, I wanted to echo them within the dd / dl HTML (definition list).
Basically, I'm just trying to brush up my skills in this area; had a look on Google but am not quite sure
Any help is appreciated!