#23344 [NEW]: wrong variable in DB common

From: Date: Fri, 25 Apr 2003 13:33:31 +0000
Subject: #23344 [NEW]: wrong variable in DB common
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15518@lists.php.net to get a copy of this message
From: tomas at dupoint dot com Operating system: win2000 PHP version: 4.3.0 PHP Bug Type: PEAR related Bug description: wrong variable in DB common OK... A WHERE-statement is sent to this method. Look how it's set in $where but when it's used the variable $sql is used instead!! The query becomes "UPDATE $table SET $set WHERE UPDATE $table SET $set" The error is marked with >>>> function buildManipSQL($table, $table_fields, $mode, $where = false) { if (count($table_fields)==0) { $this->raiseError(DB_ERROR_NEED_MORE_DATA); } $first = true; switch($mode) { case DB_AUTOQUERY_INSERT: $values = ''; $names = ''; while (list(, $value) = each($table_fields)) { if ($first) { $first = false; } else { $names .= ','; $values .= ','; } $names .= $value; $values .= '?'; } return "INSERT INTO $table ($names) VALUES ($values)"; break; case DB_AUTOQUERY_UPDATE: $set = ''; while (list(, $value) = each($table_fields)) { if ($first) { $first = false; } else { $set .= ','; } $set .= "$value = ?"; } $sql = "UPDATE $table SET $set"; if ($where) { >>>> $sql .= " WHERE $sql"; } return $sql; break; default: $this->raiseError(DB_ERROR_SYNTAX); } } -- Edit bug report at http://bugs.php.net/?id=23344&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23344&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23344&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23344&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23344&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23344&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23344&r=support Expected behavior: http://bugs.php.net/fix.php?id=23344&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23344&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23344&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23344&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23344&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23344&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23344&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23344&r=gnused

« previous php.pear.dev (#15518) next »