LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   retriving mysql data, and placing it inside a table in html using perl (https://www.linuxquestions.org/questions/programming-9/retriving-mysql-data-and-placing-it-inside-a-table-in-html-using-perl-49371/)

rhuser 03-11-2003 10:46 PM

retriving mysql data, and placing it inside a table in html using perl
 
hi

i am getting data from a database displayed on the web using PHP. i would like to place the data inside a table. how do i do this?

mysql_select_db (cctvimages);


$result = mysql_query ("SELECT * FROM imageinfo
");

if ($row = mysql_fetch_array($result)) {

do {
print ("<table border =1> <tr> <td> Data</td> </tr> </table> ");
print $row["image_id"];
print ("");
print $row["image_name"];
print ("");
print $row["image_size"];
print ("");
print $row["image_date"];
print ("<p>");
} while($row = mysql_fetch_array($result));

} else {print "Sorry, no records were found!";}

?>

j-ray 03-12-2003 05:04 AM

1. why do u ask for perl if u're writing php?

2. i guess it' rather a html question. u should print sth like

print "<table><tr><td>DATA</td><td>DATA2</td></tr>";

then the do-while-loop printing for each row
asign the array elemnts to $picture, $picture2 ...

print "<tr><td>$picture</td><td>$picture2</td></tr>";

end the loop

print "</table>";

that's what u wanted?
cheers, jens


All times are GMT -5. The time now is 01:12 PM.