Skip to Content.
Sympa Menu

freetds - Re: [freetds] freetds, php, cron

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Eddie Johnson <fast_eddie_007 AT yahoo.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] freetds, php, cron
  • Date: Wed, 13 Aug 2003 06:24:15 -0700 (PDT)

What language are you using for your script insertion?
Perl or PHP?
For PHP you need to use the addslashes() function to escape characters
for Perl you need to hmmmm...lemme try and remember.
Or this for perl... the quote() function being the fixer of the problem.

$dbh=DBI->connect('DBI:mysql:my_db:my_host', 'username', 'password');
$string=$dbh->quote("$string");
my $squery='INSERT into my_table (column) values ($string)';
my $sql=$dbh->prepare($squery);
$sql->execute;
$dbh->disconnect;

HTH,
Eddie

--- Oliver Baden <obaden AT yahoo.de> wrote:
> Hi!
>
> I have a problem when running a script via cron which
> inserts records in a mssql-database . The moment (I
> assume) a varchar-field contains characters like !-=<>
> the statement breaks with an error-message that there
> are either too many fields in the statement or that
> the syntax is incorrect. It seems that these
> characters are interpreted as an apostrophe.
>
> Running the script interactively it works fine.
>
> I also assume that the first record in the loop also
> works no problem. Only during the second or third
> insert the statement breaks.
>
> Thanks!
>
> Oliver Baden
>
>
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page