Hi All,
First of all sorry for my bad english. 🙂
I am trying to get last 4 rows of a table, and display the colums contents inside a table with "4 cells", each row results inside a cell.
So far, I learned that I have to do this:
$connection = mysql_connect (localhost, username, password);
or die("Couldn't make connection.");
$db = mysql_select_db("scan", $connection)
or die("Couldn't select database");
$pg4art = "SELECT id, titulo, imagem, texto FROM artigos ORDER BY dia DESC limit 4";
$4art = mysql_query($pg4art,$connection)
Now I believe that to tranform into arrays the colums contents I have to do this:
while ( $row = mysql_fetch_array($4art) ) {
$id = $row["id"];
$titulo = $row["titulo"];
$dia = $row["dia"];
$mes = $row["mes"];
echo ( "a bunch of things" ) ;
}
Basically I am stucked at the echo part. I got contents to grab from the database and display them, in someway like this:
$imagem $titulo | $imagem $titulo
$texto | $texto
$imagem $titulo | $imagem $titulo
$texto | $texto
Of course, there's a bunch of HTML involved to construct the table.
So, basically, how can I use the returned arrays from the while statament (or loop?) to echo it anywhere I like on my html?
Thanks A LOT!