Hi, im going through a tutorial on php from udemy.com and im curious about the following peice of code on it
[CODE]
<?php
global $connect;
$sql = “SELECT * FROM category”;
$stmt = $connect->query($sql);
while ($daterows = $stmt->fetch()){
$id = $daterows[“id”];
$categoryname = $daterows[“title”];
?>
<option><?php $categoryname; ?> </option>
<?php } ?>
why does the original author break up the while loop with php tags? i tried it the following way and it worked fine
[CODE]
<?php
global $connect;
$sql = “SELECT * FROM category”;
$stmt = $connect->query($sql);
while ($daterows = $stmt->fetch()){
$id = $daterows[“id”];
$categoryname = $daterows[“title”];
echo “<option> $categoryname </option>”;
}
?>