Jump to content

Random Function


Xtremer360

Recommended Posts

I'm just searching for some input on a function I saw and wanted someone who could explain to me what this function would mean. As I have the same db structure and was curious specifically to know what sort of values I should have inside of the fields for varcharfield and textfield.

 

function customfieldinput($fedid,$id,$groupid,$styleid)
{
$query = "SELECT
		field.id as getfieldid,
		field.is_custom as getiscustom,
		field.fullname as getfullname,
		customfields.id as getcustomfieldid,
		customfields.varcharfield as getvarchar,
		customfields.textfield as gettext
	FROM
		efed_list_fields as field
	LEFT JOIN
		efed_content_customfields as customfields
	ON
		(
			field.id = customfields.field_id and
			customfields.character_id = '$id'
		)
	WHERE
		field.fed_id = '$fedid' and
		field.style_id = '$styleid' and
		field.group_id = '$groupid' and
		field.enabled = '1' and
		field.is_custom > '0'
	ORDER BY
		field.is_custom,field.fullname";
$result = mysql_query ($query); 
while ($row = mysql_fetch_assoc($result))
{
	$fieldarray=array('getfieldid','getiscustom','getfullname','getvarchar','gettext','getcustomfieldid');
	foreach ($fieldarray as $fieldlabel)
	{
		if (isset($row[$fieldlabel])) 
		{ 
			$$fieldlabel=$row[$fieldlabel];
			$$fieldlabel=cleanquerydata($$fieldlabel);
		}
	}

	if ((isset($getcustomfieldid)) && ($getcustomfieldid > "0")) { $update = "update"; } else { $update = "new"; }

	if ($getiscustom == "1")
	{
		print "<tr>\n";
		print "<td width=120 class=rowheading>".$getfullname.":</td>";
		print "<td class=row3><textarea name=\"custom".$getfieldid.$update."\" class=\"textarea490x100\">";
		if ((isset($gettext)) && ($gettext != "")) { print $gettext; }
		print "</textarea></td>\n";
		print "</tr>\n\n";
	}
	else
	{
		print "<tr>\n";
		print "<td width=120 class=rowheading>".$getfullname.":</td>";
		print "<td class=row3><input type=text name=\"custom".$getfieldid.$update."\" class=fieldtext490";
		if ((isset($getvarchar)) && ($getvarchar != "")) { print " value=\"".$getvarchar."\""; }
		print "></td>\n";
		print "</tr>\n\n";
	}

	if (isset($getcustomfieldid)) { unset ($getcustomfieldid); }
	if (isset($getvarchar)) { unset ($getvarchar); }
	if (isset($gettext)) { unset ($gettext); }
}
}

Link to comment
https://forums.phpfreaks.com/topic/218034-random-function/
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.