Solved

Query UPDATE report

Posted on 2011-02-24
7
266 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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…
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 create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

815 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

11 Experts available now in Live!

Get 1:1 Help Now