Solved

Valid output values for a PHP/MySQL update statement

Posted on 2008-10-06
2
316 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
ID: 22648923
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
ID: 22656174
Hi aly_kayahan,

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

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

863 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

25 Experts available now in Live!

Get 1:1 Help Now