List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:April 17 1999 8:18pm
Subject:Problem with PHP 3.0.7 mysql_affected_rows(), MySQL 3.22.21
View as plain text  
>>>>> "Steve" == Steve HOUCHEN <Steve_HOUCHEN@stripped> writes:

Steve> Hello.
Steve>      I am somewhat new to PHP and MySQL.  I have MySQL 3.22.20a and PHP
Steve> 3.0.7 working with my Apache 1.3.4 web server on Red Hat Linux 5.2 at home.
Steve> However, I am trying to start using these tools on my company's intranet. I
Steve> am using MySQL 3.22.21 (binary distribution for aix4.2.1.0 on powerpc), PHP
Steve> 3.0.7, and Apache 1.3.6 on AIX 4.3.2
Steve>      Everything I have tried so far works nicely, except for
Steve> mysql_affected_rows().  The following script outputs "Affected rows: 0",
Steve> even if a row has been updated:
Steve> <SCRIPT language=php>
Steve> $db=mysql_connect("my_host","my_user");
Steve> mysql_select_db("www",$db);
Steve> $query_string="update pagers set owner_name='Blah Blah Blah' where
Steve> pager_id=11";
Steve> $result=mysql_query($query_string,$db);
Steve> print "Affected rows: ".mysql_affected_rows($db);
Steve> mysql_close($db);
Steve> </SCRIPT>
Steve> I have verified that the update happens, but mysql_affected_rows() returns
Steve> 0.  If I use mysql to issue update commands to the database, it returns the
Steve> proper number of affected rows.
Steve> This problem showed up when I started trying to use phplib-6.1 on the
Steve> server at work.  (It works on Linux at home.)
Steve> The call to mysql_affected_rows() is returning 0 and causing a problem in
Steve> the freeze() function in session.inc
Steve> I would appreciate any help that you can give!  I have searched archives
Steve> for MySQL and PHP, and didn't find any answers to this problem.

Steve> I have also posted this to the php3 mailing list.  I apologize if you
Steve> received duplicates.  I don't know if this is a problem with my
Steve> environment, PHP, or the MySQL libraries linked into PHP.

Hi!

When the above happens, it usually means one of the following:

- One has linked the php code with ab old mysql.h include file.
- One has compiled the php code with -DNO_CLIENT_LONG_LONG and the
  mysql code without the above flag.

Regards,
Monty
Thread
Problem with PHP 3.0.7 mysql_affected_rows(), MySQL 3.22.21Steve_HOUCHEN17 Apr
  • Problem with PHP 3.0.7 mysql_affected_rows(), MySQL 3.22.21Michael Widenius18 Apr