I wrote this code:
<?php
mysql_connect("localhost", "root", "root") or
die("Could not connect: " . mysql_error());
mysql_select_db("internal");
$result = mysql_query("SELECT Title, Message FROM msg");
?>
<?php
while ($row = mysql_fetch_array($result, MYSQL_NUM)){
?>
<div>
<h3><a href="#"><?php printf("%s", $row[0]); ?></a></h3>
<div><?php printf("%s", $row[1]); ?></div>
</div>
<?php
mysql_free_result($result);
}
?>
The result I´m getting is the first row of the MySQL table (With the correct formatting) I include an Image just in case:
(This is in fact the first row of my MySQL DB and the only thing I see)
The code was looping until I had to add the html tags, what I mean is that if I just do:
<?php printf("%s", $row[0]); ?>
&
<?php printf("%s", $row[1]); ?>
It looped and brought all of the results.
Could this be a syntax error?
Thanks in advance, if you need any clarification, please ask!
Trufa