Solved

Query UPDATE report

Posted on 2011-02-24
7
268 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

679 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