Solved

Query UPDATE report

Posted on 2011-02-24
7
263 Views
Last Modified: 2012-05-11
I have a script that updates a database.  It updates about 100 field from information that is being parsed from a feed.  What type of query code would I need to write so that the UPDATE that ran would report to me the fields that were updated?
0
Comment
Question by:rgranlund
  • 5
  • 2
7 Comments
 
LVL 17

Expert Comment

by:nanharbison
ID: 34973233
can you give us the update query as it is written now?
0
 
LVL 7

Author Comment

by:rgranlund
ID: 34973283
@nanharbison

$q = "UPDATE exp_weblog_data SET field_id_29='$field_id_29', field_id_30='$field_id_30', field_id_31='$field_id_31'  WHERE field_id_215='$field_id_215'";


0
 
LVL 17

Accepted Solution

by:
nanharbison earned 500 total points
ID: 34973527
How about this?
$q = "UPDATE exp_weblog_data SET field_id_29='$field_id_29', field_id_30='$field_id_30', field_id_31='$field_id_31'  WHERE field_id_215='$field_id_215'"; 

if ($return = mysql_query($q, $yourconnection))
{
	send yourself an email;
)

Open in new window

0
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.

 
LVL 17

Expert Comment

by:nanharbison
ID: 34973539
Do you know how to send email in PHP? You could include the values you updated if you want to see them.
0
 
LVL 7

Author Comment

by:rgranlund
ID: 34973606
I want to print the return on screen.  Can I echo $q?
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 34973639
Absolutely, you can echo the query!
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 34973649
You can do this
$q = "UPDATE exp_weblog_data SET field_id_29='$field_id_29', field_id_30='$field_id_30', field_id_31='$field_id_31'  WHERE field_id_215='$field_id_215'"; 

if ($return = mysql_query($q, $yourconnection))
{
	echo $q;
)

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

758 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

20 Experts available now in Live!

Get 1:1 Help Now