473,511 Members | 16,260 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Prob. w/ Script Posting Last Value

Victor Subervi wrote:
Hi;
Gabriel provided a lovely script for showing images which I am modifying
for my needs. I have the following line:

print '<img src="getpic.py?id=%d&x=%d"><br /><br /></td>\n' % (d, y)
where the correct values are entered for the variables, and those values
increment (already tested). Here is the slightly modified script it calls:
#!/usr/local/bin/python
import cgitb; cgitb.enable()
import MySQLdb
import cgi
form = cgi.FieldStorage()
picid = int(form["id"].value)
x = int(form["x"].value)
pic = str(x)
print 'Content-Type: text/html'
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
cursor= db.cursor()
sql = "select " + pic + " from products where id='" + str(picid) + "';"
cursor.execute(sql)
content = cursor.fetchall()[0][0].tostring()
cursor.close()
print 'Content-Type: image/jpeg\r\nContent-Length: %s\n' % len(content)
print content

I need to make it so that it will show all my images, not just the last
one. Suggestions, please.
TIA,
Victor
In your "page generator" page, replace

print '<img src="getpic.py?id=%d&x=%d"><br /><br /></td>\n' % (d, y)

by

for d, y in (results of some DB query to get d and y for each image):
print '<img src="getpic.py?id=%d&x=%d"><br /><br /></td>\n' % (d, y)

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Jun 27 '08 #1
0 923

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6006
by: Fred | last post by:
This script was left to me to get fixed, but since i cannot vb, i stuck. Anyone know what i have to do to make it work? <package> <job id="vbs"> <script language="VBScript"> Set WshNetwork =...
2
1830
by: Jonathan M. Rose | last post by:
I am looking for a script that I can sit on an HTML server (Linux, Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things: 1) Post news articles that consists of (i) a title...
5
4436
by: Steve | last post by:
Hi, I have a private website for 20 people that is similar to a web email client like hotmail. There are two frames, one on the left with links for "New", "History", "Todays" and a frame on the...
6
1629
by: oeyvind toft | last post by:
I have a frameset consisting of 3 frames: top, left and right. In top frame: body onload calls a js init function to set (or resets) values in textareas etc...in all frames. In right frame: A...
5
1639
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible....
15
1553
by: Raj | last post by:
Hello all: We have a table with about 2400 cells. Our requirement is to highlight the cells in the table whose data has changed, every 5 seconds. Our script behaves relatively ok in Firefox, but...
4
3005
by: Luklrc | last post by:
Hi, I'm having to create a querysting with javascript. My problem is that javscript turns the "&" characher into "&amp;" when it gets used as a querystring in the url EG: ...
2
3102
by: Muzzy | last post by:
Hi, I've used information on these newsgroups to build many pages. So I thought that now that I have my script working (something that I've been working on for about a week), I should post it so...
1
1136
by: mahajanrahuld | last post by:
hi i written the script for database connectivity with ms access , connection is proper but the script can not display any reslut on browser ..... code is ..... #!usr/bin/perl use...
0
699
by: Gabriel Genellina | last post by:
En Thu, 17 Apr 2008 15:51:43 -0300, Victor Subervi <victorsubervi@gmail.comescribió: That 'Content-Type: text/html' is wrong, you're returning an image here. Are you sure that *different*...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.