Re: DB Error: mismatch
| From: | Justin Patrin | Date: | Fri, 01 Apr 2005 17:23:40 +0000 |
| Subject: | Re: DB Error: mismatch | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18474@lists.php.net to get a copy of this message | ||
On Apr 1, 2005 6:01 AM, j.fainer@neu.edu <j.fainer@neu.edu> wrote:
> On March 28 I issued the attached email. Question: Is there a more
> appropriate list serve to issue this question? So far I have put it to
> three different lists without a single reply and I am really falling
> short on new ideas.
>
> -----Original Message-----
> From: James Fainer
> Sent: Monday, March 28, 2005 10:29 AM
> To: pear-general@lists.php.net
> Subject: [PEAR]DB Error: mismatch
>
> Does someone know the answer to this puzzle?
>
> The attached code snippet was developed and tested on a SUSE 9.1 install
> and works without any issues. But on the production server, a Sunfire
> V100 running Solaris 9.0, apache2, mysql 4.0.24 and PHP 5.0.3; all other
> code including successful queries of the database work fine, but when
> the program attempts to update or create new data the system issues a DB
> Error: mismatch. If I do a direct query to the database, I can edit all
> day. I also changed the error reporting to use mysql_error() and
> mysql_errnum() and it returns "0". I have since reinstalled mysql and
> recompiled PHP without any luck. Because I get a DB:error and no mysql
> error is there a chance there is a PEAR issue? Any ideas?
>
> snippet:
> _______________________________________
>
> $sql = $db->prepare("UPDATE cutsheet
> SET cutsheet.StationQuad = '$StationQuad',
> cutsheet.StationPort = '$StationPort',
> cutsheet.SSSystemName = '$SSSystemName',
> cutsheet.SSIPAddress = '$SSIPAddress',
> cutsheet.SStackSwitch = '$SStackSwitch',
> cutsheet.SSSwitchPort = '$SSSwitchPort',
> cutsheet.PortSpeed = '$PortSpeed',
> cutsheet.PortDuplex = '$PortDuplex',
> cutsheet.VlanNumber = '$VlanNumber',
> cutsheet.Network = '$Network',
> cutsheet.ConnType = '$ConnType',
> cutsheet.Notes = '$Notes',
> cutsheet.LastUpdate = '$Cdate',
> cutsheet.PortDisable = '$PortDisable',
> cutsheet.DatePortDisable = '$DatePortDisable',
> cutsheet.TTPortDisable = '$TTPortDisable'
> WHERE cutsheet.id = '$id'");
>
> if (DB::isError($sql)) {
>
> die($sth->getMessage());
> }
>
> $res =& $db->execute($sql, 1);
>
> if (DB::isError($res)) {
>
> die($res->getMessage());
> }
>
You should also be using quoteSmart for those values.
--
Justin Patrin