Jump to content

Help needed to retrieve data


clock

Recommended Posts

Hi folks

I desperately need some assistance for the following - this is for a custom profile field (and it is populated in the table :P )

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

Link to comment
Share on other sites

  • Administrators

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.

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

  • Members

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'); ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...