Solved

Valid output values for a PHP/MySQL update statement

Posted on 2008-10-06
2
313 Views
Last Modified: 2013-12-13
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
Comment
Question by:jmoriarty
2 Comments
 
LVL 14

Accepted Solution

by:
ali_kayahan earned 500 total points
Comment Utility
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
 

Author Comment

by:jmoriarty
Comment Utility
Hi aly_kayahan,

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

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now