Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting & displaying TEXT from database 1

Status
Not open for further replies.

jacobus

Programmer
Apr 16, 2001
15
NL
hi,
perhaps somebody can help me.
If you want to get the URL of a img out of a database you use something like : <img src=&quot;get_pic.cgi&quot;>.
This works fine.

But how do you do the same with plain text?
You need an object to trigger and store/show the text
in the HTML.

Any ideas?

Thanks.

jacobus
 
I don't understand the question, yet. Can you give a little more description of what you are trying to do?




keep the rudder amid ship and beware the odd typo
 
hi goBoating,

I have a couple of images on the page, say to the left.
On the right I have a table in which I want information
displayed concerning the image over which the mouse is
positioned.
The info is stored in a mysql database.
The script works fine.
I tried it with images (with server) and with text
(without server). Both using OptiPerl.

I don't know how to use an object/variable in HTML
and get the text into the table.

I hope this makes sense.

regards Jacobus

 
I still am not sure I understand the question, but, I'll take a shot and see what happens.

In general terms, you want to present information about an image in an HTML table adjacent to that image.
In your CGI code, assuming you have the image name or id.....

.......
$sql = &quot;select title,artists from image_info_table where image_id = $image_id&quot;;
# do the sql connect,prepare,execute and fetchrow to get the image info.
# getting fields something like,
@fields = $query->fetchrow();

print &quot;<table>&quot;;
foreach $image (@images)
{
print &quot;<tr>
<td><image src=$image></td>
<td>title: $fields[0]<br>artist:$fields[1]</td>
</tr>&quot;;
}
print &quot;</table>&quot;;
........

Hopefully, this speaks to your situation. There are a lot of decisions about how to do the database stuff, but, you say 'the script runs fine' so I guess you have that working already.




keep the rudder amid ship and beware the odd typo
 
thanks man,

it's not exactly what I was looking for, but I changed my strategie and went from there.

jacobus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top