I'm new to PHP and I wanted to know if this is done correctrly. I want to display multiple rows from a table in two different places from the website:
<ul>
<li><input type="text" name="first" id="first" />
<ul>
<?php
while($row = mysql_fetch_assoc($sql)){
$name = $row["name"];
echo <li>$name</li>;
}
?>
</ul>
</li>
<li>Vs.</li>
<li><input type="text" name="second" id="second" />
<ul>
<?php
while($row = mysql_fetch_assoc($sql)){
$name = $row["name"];
echo "<li>$name</li>";
}
?>
</ul>
</li>
<li><input type="submit" name="submit" id="submit" value="Compare!"/></li>
</ul>
The first while works perfectly, but the second one does not display anything.