I want to call a function that gets information from my database and I input the table column names I want into the function and it uses that to retreive and return an array with what it has.
function GetUserInfo($table_names)
{
require("user_cnt.php");
$Query = "SELECT " . $table_names . " FROM $TableName WHERE user_char_name='$user'";
$Result = mysql_db_query($DBName, $Query, $Link);
$col = mysql_fetch_array ($Result);
return $col;
}
$col = GetUserInfo("user_real_name");
echo $col[user_real_name];
How might I go about doing this? My output is blank just this code. Thank you for your time.