in reply to Mysql error near values(

unless($dbh->do("UPDATE storage SET (url = ?, altavista = ?, yahoo = ? +, msn = ?, teoma = ?, google = ?, alltheweb = ?, total += total +1, time = ?",undef,$url,$altavista_results,$yahoo_results,$m +sn_results,$teoma_results,$google_results,$alltheweb_results,$time) > + 0){ $dbh->do("INSERT INTO storage (url, altavista,yahoo, msn, teoma, goo +gle, alltheweb,Total, lastsearch, totalsearch) values(?,?,?,?,?,?,?,? +,?)",undef,$url, $altavista_results, $yahoo_results, $msn_results, $t +eoma_results, $google_results, $alltheweb_results, $total,$time, $tot +al)"); }


Edit: you should have a look on the "insert ... on duplicate key" syntax: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html

Replies are listed 'Best First'.
Re^2: Mysql error near values(
by coldfingertips (Pilgrim) on Feb 04, 2006 at 23:50 UTC
    Is there a syntax error in yoru code? I C/P'd and the whole thing went nuts on me.

    I took a quick look on insert on duplicate key but I want the opposite of what it does. From what I read, it'd make a duplicate of it if it's found. I'd only want to insert IF the column "url" was not found in the first place.

    Thanks.

      I C/P'd and the whole thing went nuts on me.

      When you did that, were you careful to remove all the "+" characters that had been inserted by PM's own code-line-wrap logic?

      It looks like reneeb was not so careful about this, because that post includes  total += total +1 (where the first "+" had been added by PM line-wrapping).

      BTW, "went nuts" doesn't sound like the kind of error code that I could look up and help you with. If you don't actually look at the content of the error report, and don't show us what it is, how do you expect to fix the error?

      Any error messages??