in reply to Re: Re: Re: Re: DBD::CSV - how to install? (FTP only)
in thread DBD::CSV - how to install? (FTP only)
The below code fails on the line: $dbh->func( 'users', 'CSV', 'users.csv' 'ad_catalog');
What is the error or warning message you get?
Update oh never mind, I just spotted it (although in the future please always show the error message rather than just saying "it failed"). The problem here is that you don't have a comma between 'users.csv' and 'ad_catalog'. If you copied that from the docs and the docs look like that, please let me know where so I can fix it :-).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: Re: DBD::CSV - how to install? (FTP only)
by lwicks (Friar) on Dec 21, 2003 at 11:01 UTC | |
Please ignore the comments they are just print statements I have been using to tell me what is going on. The code I have written is below: Again thanks for the help from you and everyone so far, I am slowly getting brain into gear and starting to understand things a little.
Kia Kaha, Kia Toa, Kia Manawanui! Be Strong, Be Brave, Be perservering! | [reply] [d/l] [select] |
by jZed (Prior) on Dec 21, 2003 at 19:05 UTC | |
My strong suspicion is that you're not getting a $ID value from the form and that you are essentially trying to insert '' into the database which (because of a bug) produces the odd error message you got. The other thing that is tripping you up is the quoting in SQL. A SQL insert looks something like this: INSERT INTO foo (first_col,second_col) VALUES ('string',7). Notice that string has single quotes around it and the number does not. It works the same way with variables - INSERT INTO foo (first_col,second_col) VALUES ( '$string', $number ). Your INSERT statement has no quotes around anything. The best solution is to never have to care about the quotes: USE PLACEHOLDERS: No quotes, no muss, no fuss. See the DBI docs on placeholders. Another good way to catch problems is to always (when debugging) print out the SQL before executing it: DBI::trace() will also show you that same information, eventually you might want to check it out (see the DBI docs). Hopefully all that is enough for you to be able to debug your script. If not, holler. | [reply] [d/l] [select] |
by lwicks (Friar) on Dec 22, 2003 at 21:08 UTC | |
Cheers for another useful reply. Anyway, I shall take what you have kindly written and see what sort of mess I can create. Watch this space! Lance P.s. If you think my code at the moment is bad, you should have seen it before I started from scratch! :-)
Kia Kaha, Kia Toa, Kia Manawanui! Be Strong, Be Brave, Be perservering! | [reply] |
by lwicks (Friar) on Dec 29, 2003 at 21:00 UTC | |
by lwicks (Friar) on Dec 23, 2003 at 21:42 UTC | |
I have added a line that shows me the parameters returned from param() It just lists the fields from the CGI form as opposed to the values. If someone can help on this I'd appreciate it. Lance | [reply] |