On Tue, Jun 18, 2002 at 12:10:58PM +0530, Ma Siva Kumar wrote:
>
> I am trying to write a function which takes in an associative array (from a
> user submitted form for example), converts the keys to a column array and
> values to a value array. These arrays together with the name of the database
> table are fed into another function, which generates the query string (insert
> into $table ($colmn) values ($value)).
>
> As a short cut, I am enclosing all the values (numeric as well as strings)
> in single quotes when generating the arrays. In my trials so far,
> everything is fine. What will be the issues in enclosing numeric values in
> single quotes?
Absolutly none. In fact, it will work better than if you attempt to leave
them off, since without quote, they'll all be interpreted as int4. With
quotes, they'll all be interpreted by the appropriate input function for
each type.
Don't forget to escape the ' and \ characters.
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.