php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6483 mysql_affected_rows not functioning
Submitted: 2000-09-01 11:40 UTC Modified: 2000-09-01 12:16 UTC
From: tsmith at qsigroup dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0.1pl2 OS: osx server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tsmith at qsigroup dot com
New email:
PHP Version: OS:

 

 [2000-09-01 11:40 UTC] tsmith at qsigroup dot com
I upgraded to PHP Version 4.0.1pl2 and mysql_affected_rows no longer works.  mysql_num_rows works, but all my pages that query the DB using a DELETE, UPDATE, and INSERT and checking with mysql_affected_rows returns nothing.  It worked when I had PHP3.  Did the format change???


$queryB = "INSERT INTO $userstable (l_name, f_name, title, business, address, city, state, zipcode, bus_tel, bus_fax, email) VALUES ('$l_name','$f_name','$title','$business','$address','$city','$state','$zipcode','$bus_tel','$bus_fax','$email')";
		$resultB = MYSQL_QUERY($queryB);
		@$numberB = MYSQL_AFFECTED_ROWS($resultB);
		PRINT "This is numberB: ".$numberB."<BR>";

		if ($numberB != "1")
			{
			PRINT "<CENTER><H3>Insert into PRSA was unsuccessful.</CENTER></H3>";
			EXIT;
			}
		}
	
	PRINT "<CENTER><H3>Insert was successful!</CENTER></H3>";

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-01 11:59 UTC] tsmith at qsigroup dot com
This is the error I receive for this line of code.
Line of code:
     $numberB = MYSQL_AFFECTED_ROWS($resultB); 
Error message:
   Warning: Supplied argument is not a valid MySQL-Link resource in
/Local/Library/WebServer/WebSites/PRSA/prsaInput.php on line 68


 [2000-09-01 12:16 UTC] sniper@php.net
http://www.php.net/manual/function.mysql-affected-rows.php

int mysql_affected_rows ([int link_identifier])

Leave that $resultB out. Then it works.

--Jani
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 20:01:29 2025 UTC