I have a table called "users", in the table it contain a column/ field name "reg_date" how would i run an query to say: For all the users, if their feild "reg_date" is blank put "20th December 2008"
welbyobeng
3
Junior Poster in Training
Recommended Answers
Jump to PostYou could do it in the query itself, but since you're posting in the PHP section, I asume you want to do it using PHP functions.
So, you could do something like this:
<?php // Not tested $sql = "SELECT TRIM(`reg_date`) FROM `users` ORDER BY `id`"; …
Jump to PostCan I get an sql query only?
Sure, here you have:
SELECT IF(TRIM(`reg_date`) != '', `reg_date`, DATE_FORMAT(NOW(), '%D %M %Y')) FROM `records`;
All 7 Replies
=IceBurn=
8
Newbie Poster
welbyobeng
3
Junior Poster in Training
=IceBurn=
8
Newbie Poster
Aamit
-7
Posting Whiz
welbyobeng
3
Junior Poster in Training
=IceBurn=
8
Newbie Poster
=IceBurn=
8
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.