View Full Version : Using query_read to get birthday
dfc005
10-31-2010, 10:41 PM
I'm trying to use query_read to get a users birthday to display it to them in a custom page. But for some reason, it's always blank when it's returned.
I tried using birthday_search as well, it also comes back blank.
Any ideas?
HyperActiv
10-31-2010, 11:28 PM
Have you tried:
$db->query("
SELECT user.birthday
FROM " . TABLE_PREFIX . "user
");
dfc005
10-31-2010, 11:36 PM
Yup. Returns one row but that row has no value for birthday.....
JamesC70
10-31-2010, 11:56 PM
If you're already including the vBulletin framework in your custom page, then $userinfo[birthday] will contain the user's birthdate.
dfc005
11-01-2010, 12:06 AM
I assume as much but it's not returning anything either.
When I do a print_r on userinfo, I get the following....
Array ( [userid] => 8 [field7] => [field5] => [subfolders] => [pmfolders] => => [ignorelist] => [signature] => [searchprefs] => [rank] => [usergroupid] => 6 [membergroupids] => [displaygroupid] => 6 [username] => DFC005 [password] => 123456789 [passworddate] => 1274396424 [email] => email@email.com [styleid] => 1 [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => 2 [showbirthday] => 2 [usertitle] => Administrator [customtitle] => 0 [joindate] => 1272349434 [daysprune] => 0 [lastvisit] => 1288045810 [lastactivity] => 1288045810 [lastpost] => 1273533161 [lastpostid] => 0 [geoip_location] => au [posts] => 1 [reputation] => 10 [reputationlevelid] => 1 [timezoneoffset] => [pmpopup] => 0 [avatarid] => 0 [avatarrevision] => 0 [profilepicrevision] => 0 [sigpicrevision] => 0 [options] => 11536471
[B][birthday] => [birthday_search] => 0000-00-00
[maxposts] => -1 [startofweek] => 1 [ipaddress] => [referrerid] => 0 [languageid] => 0 [emailstamp] => 0 [threadedmode] => 0 [autosubscribe] => -1 [pmtotal] => 0 [pmunread] => 0 [salt] => 7YAl3H0'O6@-J'8Yss3sYYa{@m|Pw_ [ipoints] => 0 [infractions] => 0 [warnings] => 0 [infractiongroupids] => [infractiongroupid] => 0 [adminoptions] => 0 [profilevisits] => 2 [friendcount] => 0 [friendreqcount] => 0 [vmunreadcount] => 0 [vmmoderatedcount] => 0 [socgroupinvitecount] => 0 [socgroupreqcount] => 0 [pcunreadcount] => 0 [pcmoderatedcount] => 0 [gmmoderatedcount] => 0 [saved_languageid] => 0 [lang_options] => 1 [lang_code] => en [lang_charset] => ISO-8859-1 [lang_locale] => [lang_imagesoverride] => [lang_dateoverride] => [lang_timeoverride] => [lang_registereddateoverride] => [lang_calformat1override] => [lang_calformat2override] => [lang_logdateoverride] => [lang_decimalsep] => . [lang_thousandsep] => , [showsignatures] => 1 [showavatars] => 1 [showimages] => 1 [coppauser] => 0 [adminemail] => 1 [showvcard] => 0 [dstauto] => 1 [dstonoff] => 0 [showemail] => 0 [invisible] => 0 [showreputation] => 0 [receivepm] => 1 [emailonpm] => 0 [hasaccessmask] => 0 [postorder] => 0 [receivepmbuddies] => 0 [noactivationmails] => 0 [pmboxwarning] => 0 [showusercss] => 1 [receivefriendemailrequest] => 1 [vm_enable] => 1 [vm_contactonly] => 0 [pmdefaultsavecopy] => 0 [adminavatar] => 0 [adminprofilepic] => 0 [urlusername] => Mute [musername] => Mute [displaygrouptitle] => Administrators [displayusertitle] => Administrator [realstyleid] => 0 [securitytoken_raw] => dd4f3f7f40f585aff41cea7cb0587c942f0a5e25 [securitytoken] => 1288573456-8e7af88a0331421eeb754fe2dd1e963e6a737d8b [logouthash] => 1288573456-8e7af88a0331421eeb754fe2dd1e963e6a737d8b [tzoffset] => [lastvisitdate] => 10-25-2010 10:30 PM [permissions] => Array ( [usergroupid] => 6 [title] => Administrators [description] => [usertitle] => Administrator [passwordexpires] => 180 [passwordhistory] => 360 [pmquota] => 50 [pmsendmax] => 5 [opentag] => [closetag] => [canoverride] => 0 [ispublicgroup] => 0 [forumpermissions] => 16777215 [pmpermissions] => 7 [calendarpermissions] => 63 [wolpermissions] => 31 [adminpermissions] => 3 [genericpermissions] => 2147483583 [genericpermissions2] => 1 [genericoptions] => 55 [signaturepermissions] => 237567 [visitormessagepermissions] => 63 [attachlimit] => 0 [avatarmaxwidth] => 80 [avatarmaxheight] => 80 [avatarmaxsize] => 20000 [profilepicmaxwidth] => 100 [profilepicmaxheight] => 100 [profilepicmaxsize] => 65535 [sigpicmaxwidth] => 500 [sigpicmaxheight] => 100 [sigpicmaxsize] => 10000 [sigmaximages] => 0 [sigmaxsizebbcode] => 7 [sigmaxchars] => 0 [sigmaxrawchars] => 0 [sigmaxlines] => 0 [usercsspermissions] => 63 [albumpermissions] => 255 [albumpicmaxwidth] => 600 [albumpicmaxheight] => 600 [albumpicmaxsize] => 100000 [albummaxpics] => 100 [albummaxsize] => 0 [socialgrouppermissions] => 65535 [pmthrottlequantity] => 0 [groupiconmaxsize] => 65535 [maximumsocialgroups] => 5 ) [forumpermissions] => Array ( [1] => 16777215 [2] => 16777215 ) [attachmentextensions] => bmp doc gif jpe jpeg jpg pdf png psd txt zip [attachmentpermissions] => Array ( [bmp] => Array ( [permissions] => 1 [size] => 20000 [height] => 280 [width] => 620 ) [doc] => Array ( [permissions] => 1 [size] => 20000 [height] => 0 [width] => 0 ) [gif] => Array ( [permissions] => 1 [size] => 20000 [height] => 280 [width] => 620 ) [jpe] => Array ( [permissions] => 1 [size] => 20000 [height] => 280 [width] => 620 ) [jpeg] => Array ( [permissions] => 1 [size] => 20000 [height] => 280 [width] => 620 ) [jpg] => Array ( [permissions] => 1 [size] => 100000 [height] => 0 [width] => 0 ) [pdf] => Array ( [permissions] => 1 [size] => 20000 [height] => 0 [width] => 0 ) [png] => Array ( [permissions] => 1 [size] => 20000 [height] => 280 [width] => 620 ) [psd] => Array ( [permissions] => 1 [size] => 20000 [height] => 0 [width] => 0 ) [txt] => Array ( [permissions] => 1 [size] => 20000 [height] => 0 [width] => 0 ) [zip] => Array ( [permissions] => 1 [size] => 100000 [height] => 0 [width] => 0 ) ) [reallanguageid] => 0 )
Both birthday and birthday_search are blank. Is this a vB setting some where?
JamesC70
11-01-2010, 12:23 AM
Are you testing with an account that's unalterable (per your config file)?
The only account in my database with no birthdate and a birthday_search of 0000-00-00 is my admin account, user #1.
If you look in your database through phpMyAdmin or similar, what's in the birthdate field for user #8?
dfc005
11-01-2010, 12:31 AM
It's an admin account and it's unalterable but it certainly has a birthdate and birthday_search as I've checked the table using phpMyAdmin.
--------------- Added 1288576002 at 1288576002 ---------------
Tried accessing a different userid which isn't an admin and isn't locked and it has the same problem.
--------------- Added 1288586885 at 1288586885 ---------------
OK, after further testing, it seems to only be a problem on my development server. No idea how to fix it though.
HyperActiv
11-01-2010, 11:24 AM
Yup. Returns one row but that row has no value for birthday.....
What do you mean row has no value for birthday?
In some of the cases you'll need to use PHP function date(); to get logical date, and not the unix time.
dfc005
11-01-2010, 08:03 PM
The row was simply blank, no value. Not sure why it wasn't working on my development server but I reinstalled a fresh copy of vBulletin and it all seems to be fine now.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.