Fred wrote:
> No matter what I type in the form text box (or even if I leave it
> blank) I get all the records.

Try this:

#!/usr/local/bin/python
print "Content-Type: text/html\n"
import MySQLdb
import cgi

db=MySQLdb.connect(host = 'localhost', db = 'phone')
cursor=db.cursor()
cursor.execute("Select * from phone where name=%s order by name", (name,))

result = cursor.fetchall()
for record in result:
     print '<p>'
     print record[0]
     print '--'
     print record[1]
     print '--'
     print record[2]
     print '--'
     print record[3]
     print '</p>'

(Assuming the name of your text field is "name".)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to