clock Posted June 7, 2014 Report Share Posted June 7, 2014 Hi folks I desperately need some assistance for the following - this is for a custom profile field (and it is populated in the table ) Here is the PilotData.Class.php function: public static function getFieldValue($pilotid, $title) { $sql = "SELECT f.fieldid, v.value FROM ".TABLE_PREFIX."customfields f, ".TABLE_PREFIX."fieldvalues v WHERE f.fieldid=v.fieldid AND f.title='$title' AND v.pilotid=$pilotid"; $res = DB::get_row($sql); return $res->value; } In the layout.tpl file, I am trying to display the data as follows: <strong>Pilot VID: </strong> <?php echo PilotData::getFieldValue($pilotid, 'IVAO'); ?> I am getting nothing I have also tried this code in the PilotData.class.php: public function GetIvaoId($pilotid) { $query = "SELECT value FROM phpvms_fieldvalues WHERE pilotid='$pilotid'"; $res = DB::get_row($query); echo DB::$error; if($res) return $res->value; else return 0; } Also with no success I REALLY would aapreciate some assistance with the above. I know some php but am no fundi I could be making a fundamental mistake here but am not sure Thanks Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted June 8, 2014 Administrators Report Share Posted June 8, 2014 In the first function do you have a custom field set up as "IVAO" exactly? The second function looks like it will try to grab the first row in the table that has a matching pilotid field, it could be anything. Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted June 8, 2014 Members Report Share Posted June 8, 2014 I have a question why don't you use the function of phpvms of adding custom fields in the profile ? it is located admin section /site & settings/profile fields Quote Link to comment Share on other sites More sharing options...
clock Posted June 8, 2014 Author Report Share Posted June 8, 2014 I have a question why don't you use the function of phpvms of adding custom fields in the profile ? it is located admin section /site & settings/profile fields Vangelis, that is exactly how it was done In the first function do you have a custom field set up as "IVAO" exactly? The second function looks like it will try to grab the first row in the table that has a matching pilotid field, it could be anything. We do have a custom field set as "IVAO" Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted June 8, 2014 Members Report Share Posted June 8, 2014 if you write inder this code <?php echo $pilotid ; ?> do you get the id ? <strong>Pilot VID: </strong> <?php echo PilotData::getFieldValue($pilotid, 'IVAO'); ?> you can also try <strong>Pilot VID: </strong> <?php echo PilotData::getFieldValue(Auth::$userinfo->pilotid, 'IVAO'); ?> Quote Link to comment Share on other sites More sharing options...
clock Posted June 9, 2014 Author Report Share Posted June 9, 2014 Thanks Vangelis, second option did the trick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.