• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

Valid output values for a PHP/MySQL update statement

Hey folks,

I have a program I'm working on to automate updating of various types of data. I basically have a form, with a button that allows anyone in the HR department to click it and automatically run an update query based on pre-defined values.

My question is, I know (or rather, as far as I'm aware) update normally just returns a boolean value of true/false on success/failure, but is it possible to output to the browser the values that were updated? Or even, how many lines were updated?

For example, if hitting the button would update 10 lines in a given table, is it possible to either, A) output which lines were updated, or B) simply output "10 lines updated" etc.

Thanks!
James
0
jmoriarty
Asked:
jmoriarty
1 Solution
 
Ali KayahanFull Stack DeveloperCommented:
Hi jmoriarty; You can get the affected row counts just running  ;
     
     mysql_affected_rows() ;

  After your query , so you can log it or output...
 
0
 
jmoriartyAuthor Commented:
Hi aly_kayahan,

Thanks, that's exactly what I was looking for!

0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now