[nycphp-talk] can't populate db table with csv - I can't believe this!
Hans Zaunere
hans at nyphp.org
Wed Sep 10 20:22:21 EDT 2003
Phil,
> Go to http://www.nordicnet.no/admin/alle_produkter.php and you can see
> the damage!
You need to learn some basics of working with SQL. In MySQL, Oracle, PostgreSQL, and just about everything else, values should always be enclosed in single quotes [1].
With the SQL you show above, none of the values are enclosed in single quotes, and since one of the values contains a single quote itself, it gives an error. You'll also need to use mysql_escape_string() for every value you create a SQL statement from; this escapes special chars that SQL will interpret as having meaning. See http://php.net/mysql_escape_string
> Otherwise, I'm going to have to send the code to you guys, along with
> the .csv file and maybe you can do what I cannot. I might as well quit
> this project!
I think you might have to move to a pay-per-incident support plan :)
But this is a simple problem to resolve; you should have no problem with it.
H
[1] For the purposes of this discussion
More information about the talk
mailing list