View Full Version : SQL Query help
DAMINK
02-17-2012, 09:06 PM
I have a small lingering problem on my forum.
I merged from mybb a couple of years ago. All went ok however i have some users who registered and did not fill in there date of birth details.
Now when i go to one of those user profiles i get a small error.
Not a real big problem however i was wondering if i could just run a query to change everyone that has no DOB to a generic type one so the errors would stop?
Specifically could someone help me create the query?
Thanks.
DAMINK
02-25-2012, 12:07 AM
Bump?
Lynne
02-25-2012, 05:20 PM
Not tested (so do so on your test site first), but something like:
UPDATE user
SET birthday = '' , birthday_search='0000-00-00'
WHERE birthday = ***
*** is whatever is actually in the field currently which you have not told us
It kinda depends on what is actually in the database instead of the birthday. I have users on my vB4 site with no birthday (it's blank) and the birthday_search just equal to '0000-00-00' and I have no issues editing them. So, perhaps you can be more specific about the exact error and about what *exactly* is in the database for these users.
DAMINK
02-25-2012, 10:46 PM
Thankyou for the reply Lynne.
Im sorry about the lack of information.
The error i receive is as below. This error is at the top of the page when loading there profiles.
Warning: mktime() expects parameter 4 to be long, string given in [path]/includes/class_userprofile.php on line 260
The user in question has a DOB of January 1 (2012) visible in his profile however the database shows -- in the DOB row. As image below.
http://www.ftw.net.au/fileuploads3/13302133853530_Capture.png
So would it be something like this?
UPDATE user
SET birthday = '' , birthday_search='1970-01-01'
WHERE birthday = ==
Or would it be like below
UPDATE user
SET birthday = '' , birthday_search='1970-01-01'
WHERE birthday = 2012-01-01
lol i really have no idea to be honest.
--------------- Added 1330222800 at 1330222800 ---------------
Update. I got it to work... Not sure if it was the correct way or anything lol but did this.
UPDATE user
SET birthday = '' , birthday='1970-01-01'
WHERE birthday = '--'
Now everyone that had no birthday atleast has one.
Not an ideal fix but works for me none the less.
Thanks again Lynne.
Lynne
02-26-2012, 03:47 AM
The query you finally ran is the one I would have suggested based on what you posted. So, good job! :)
DAMINK
02-26-2012, 03:55 AM
:) Thankyou Lynne. Honestly without your help i was lost.
I did try learning querys but was very worried i would do something wrong.
But now i feel a little more comfortable with querys.
I did a slight variation of that to suit my prefix but other than that it was a perfect fix :)
Again thankyou x100.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.