Jump to content


Photo

PHP/mySQL record update


  • Please log in to reply
1 reply to this topic

#1 highaspen

highaspen
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 01 March 2006 - 05:30 PM

Does anybody out there know the mySQL syntax to not update a record if the input field is null?

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 01 March 2006 - 05:41 PM

if ($_POST !== '') {

//query

} else {
echo("Field was NULL");
}

Or what you could do if you editing records is pull all your values into the txt fields first then you only have blank fields where there blank int he database anyway.. take a look at this..
[a href=\"http://www.blucode.net/norman/ticket_view.php\" target=\"_blank\"]http://www.blucode.net/norman/ticket_view.php[/a]

You can click edit and shows all the selections already then when u update it just does it wether it's blank or not because if blank then the user must have ment to make it blank for a reason.
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users