[thelist] Cold Fusion problem

Judith Taylor judi at frognet.net
Mon Feb 12 11:32:14 CST 2001

The use of quotes in SQL is simple - once you learn it/them. :o)

Whenever you are inserting text strings into the db, they must be 
encapsulated with single quotes. This also holds true for your WHERE clause 
in an SQL statement.

In your example, if item is a number, do not use quotes. Author, pub, 
condition, format, desc all seem to be text strings, so you would use 
quotes around them. Date and price are generally treated as numbers, so no 
quotes. And if cat is a number, also no quotes, but if it is a text field, 
do use quotes.

Let me know if this doesn't make any sense....


Robin Hastings put into words:
>  I'm having problems with an insert statement in one of my pages that is
>driving me nuts! I'm getting a "syntax error" and I'm sure it is just the
>quotes that I'm using, but I've never really understood the use of quotes in
>SQL - so I can't figure out how to make it work. The statement is:
><CFQUERY NAME="insert" DataSource="book">
>     INSERT INTO tblBook
>     (item, author, pub, date, price, condition, format, cat, desc)
>     VALUES
>     ('#form.item#', '#form.author#', '#form.pub#', #form.date#,
>#form.price#, '#form.condition#', '#form.format#', '#form.cat#',
>This is the latest incarnation - I've tried it a couple of different ways.
>If anyone can help I'd be eternally grateful!!! I'd send the URL, but it is
>in a protected directory - you understand... ;)

Judith Taylor
Webmaster - http://www.busybobbins.com
ICQ: 67460562

Freelance ColdFusion Developer

More information about the thelist mailing list