I’d like to loop through and output all the records in my table but if the $id were to equal 4 or 6 I need it to append a string to the ID value.
My current code:
$sql = "SELECT * FROM publications";
$sqlres = mysql_query($sql);
while ($row = mysql_fetch_array($sqlres)) {
$id = $row['id'];
echo $id;
}
How do I achieve this?
Many thanks for any pointers.
You can test for the values and echo something more like P.Martin said, or you can append it to the variable: