Skip to content

Instantly share code, notes, and snippets.

@ziyahan
Created October 23, 2012 13:16
Show Gist options
  • Save ziyahan/3938672 to your computer and use it in GitHub Desktop.
Save ziyahan/3938672 to your computer and use it in GitHub Desktop.
Veritabanından Dönen Sonuç Kümesini HTML Tabloya Dönüştürmek (PHP).
private function html_table_returner($arr,$shows,$event="",$elementid=0)
{
$shows=@explode(" ", $shows);
$json2="<table id='rtntbl' border='1'>";
for($i=0;$i<=count($arr)-1;$i++)
{
$json2.="<tr>";
foreach($arr[$i] as $key=>$value)
{
$json2.="<td ";
if(@in_array($key, $shows))
{
if($event)
{
$json2.=" onclick='$event(this,$elementid)' ";
}
}
else
$json2.="style='display: none;'";
$json2.=" class='$key'";
$json2.=">$value</td>";
}
$json2.="</tr>";
}
$json2.="</table>";
return $json2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment