Jump to content

very easy regex (not for me)


jd22

Recommended Posts

Dear salathe

Thank you for your reply.

I build a function yesterday it is simple but works fine form.

function EnumFileds($Table, $Column)
{
	$DSP_RESULT = "";
	$ENUM_NAME = "SHOW COLUMNS FROM " .$Table. " LIKE '" .$Column. "'";
	$ENUM_QUERY = mysql_query($ENUM_NAME);
	$ENUM_ROW = mysql_fetch_array($ENUM_QUERY);

	$GetCol = preg_match("/['](.*)[']/", $ENUM_ROW['Type'], $matches);
	$SplitIt = str_replace("'", "", $matches[0]);
	$Result = explode(",", $SplitIt);
	for($i=0; $i<count($Result); $i++)
		$DSP_RESULT .= '<option value="' .$Result[$i]. '">' .$Result[$i]. '</option>';
	return $DSP_RESULT;
}

 

I hope this code help someone else.

 

Thank you again for your help.

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.