By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

how to stop upadting data fields with empty in php

P: 45
hi everyone,

i m having a problem with my php update code.

i have 7 text fields in a webpage.
i have written a code for updating multiple fields in database and it's working properly.but the problem is that, suppose when i m trying to update 3 outof 7 fields to be updated,the rest of the fields updates with simply with empty values.

now what can i do to restrict the others fields from updating. i just want the desirable fields willbe updated and other fields will remain (contain previous value) same.

for ur kind information i m using oracle database and php4.

Thanks in advanced
Oct 19 '08 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
You need to run through your array (foreach loop) and find which array keys hold a value and then construct your query on that.

Post the code you're using (use code tags).
Oct 19 '08 #2

Atli
Expert 5K+
P: 5,058
Yes, like Markus says, you need to find out which of your fields are empty and leave those out of the query.

The empty function may come in handy for that.
Oct 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.