Jump to content

return a dynamic field value


SystemOverload

Recommended Posts

PHP 5.2.5

 

Inside a PHP function, I've returned a set of results from a table, there will only ever been one record.

 

while ($arrAccVerify = mysql_fetch_array($rsAccVerify)) { 
$fldContactName = $arrAccVerify['contact_name']; 
return $fldContactName;
}

 

but what if I want to return a dynamic field, ie, the field of choosing at the time i call the function, ie:

 

$varReturnField = "contact_email";

while ($arrAccVerify = mysql_fetch_array($rsAccVerify)) { 
$fldReturnField= $arrAccVerify['$varReturnField']; 
return $fldReturnField;
}

 

I tried this and i just get [Notice: Undefined index: $varReturnField]... Is what I am trying to achieve possible, and if so, how???

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/173040-return-a-dynamic-field-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.