View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-11-2003, 10:46 PM   #1
Registered: Jan 2003
Posts: 55

Rep: Reputation: 15
retriving mysql data, and placing it inside a table in html using perl


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!";}

Old 03-12-2003, 05:04 AM   #2
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,502

Rep: Reputation: 121Reputation: 121
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem inserting data into a mysql table using PHP Rockgod2099 Programming 13 08-03-2005 12:27 AM
why do i get this error when inserting data to a mysql table verbatim Programming 2 06-15-2005 06:12 AM
mysql - transfer data from one table to another?? macinslaw Programming 22 08-20-2004 01:29 PM
MySQL non-realtime table-by-table mirroring Passive Linux - Software 1 01-20-2004 12:11 PM
How to import MS ACCESS Table including OLE filed into the MySQL Table ? myunicom Linux - General 1 11-28-2003 11:30 AM

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration