PHP4, mysql and horde: Why IMP from woody won't work with PHP4
On Tue, 18 Jul 2000, Ivan E. Moore II wrote:
Ok, I think I finally found it:
phplib, file ct_sql.inc, class CT_Sql, function ac_store, in the horde
version of phplib exactly on line 90ff:
---snip1 ct_sql.inc---
$this->db->query($uquery);
if ( $this->db->affected_rows() == 0
&& !$this->db->query($iquery)) {
$ret = false;
}
---snip1---
That's to check if there's already a session open. If yes, it does an
update, if no, it does an insert.
affected_rows stems from db_mysql.inc and looks like this
---snip2 db_mysql.inc---
/* public: evaluate the result (size, width) */
function affected_rows() {
return @mysql_affected_rows($this->Link_ID);
}
---snip2---
searching this function in
/usr/lib/php4/DB/mysql.php, we find:
(in the source tarball this is in php4-4.0.1pl2/pear/DB/mysql.php)
---snip3 mysql.php---
// TODO/wishlist:
// simpleFetch
// simpleGet
// affectedRows
---snip3---
which leads me to the conclusion that mysql_affected_rows seems not to be
implemented in php4 version 4.0.1pl2-2, therefore obviously returns 0 and
causes ac_store to do an insert instead of an update.
But I may be wrong...
So much for the problem, I am not a programmer so I cannot provide a quick
solution...
regards
Alex
Reply to: