Dennis Lee Bieber wrote:
> On Sat, 28 Jan 2006 10:14:44 -0800, Kirk McDonald <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>
>>The comma is intentional: the MySQLdb wants the argument(s) as a tuple.
>
>
> The DB-API wants tuples... But my last perusal of the MySQ
Perfect again Kirk! Now I will study all this so I actually understand
what is happening..
Thanks!
Fred
--
http://mail.python.org/mailman/listinfo/python-list
Fred wrote:
> OK one more... how would I do a "LIKE" instead of a = in this code?
>
> cursor.execute("Select * from phone where name=%s order by name",
> (form['name'].value,))
>
> Right off I think:
>
> cursor.execute("Select * from phone where name like %%s% order by
> name",
> (fo
OK one more... how would I do a "LIKE" instead of a = in this code?
cursor.execute("Select * from phone where name=%s order by name",
(form['name'].value,))
Right off I think:
cursor.execute("Select * from phone where name like %%s% order by
name",
(form['name'].value,))
But it blow
Thanks Kirk! That worked perfect! And makes perfect since now that I
see it...
Now that I have the main pieces working I can start expanding from
here!
Fred
--
http://mail.python.org/mailman/listinfo/python-list
Fred wrote:
> Yeah, I already tried that (except you have a , after name.
>
> Your code produces the same error:
>
> NameError: name 'name' is not defined
>
> I know I am close!! Just missing some small thing...
>
Oh, duh. I forgot something:
#!/usr/local/bin/python
print "Content-Type: text
Yeah, I already tried that (except you have a , after name.
Your code produces the same error:
NameError: name 'name' is not defined
I know I am close!! Just missing some small thing...
--
http://mail.python.org/mailman/listinfo/python-list
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("Se
print MySQLdb.paramstyle returns: format
I found one example like this:
cursor.execute('''Select * from phone where name=%s order by
name''',(name))
But I get this in my Apache error log:
NameError: name 'name' is not defined
Like my last problem I posted, I am sure it is something very simple
>
> db=MySQLdb.connect(host = 'localhost', db = 'phone')
> cursor=db.cursor()
> cursor.execute("Select * from phone where name = name order by name")
You don't parametrize the query. The where-clause thus is a tautology,
as the name is always the name.
Do something like this:
cursor.execute("
OK,
I can now successfully enter data into my MySQL database through my CGI
web page. I can click a button and retrieve all the records, but I can
not seem to get the search code to work.
Below is the web page code and then my Python script. When I click my
search button it just gives me all the
11 matches
Mail list logo