MySQL Forums
Forum List  »  PHP

Hoe to call function in PHP
Posted by: Matjaz Toplisek
Date: September 01, 2005 03:31AM

I have function to show table from my database.
Does somebody knows how to call function?
I hope you can help

Code:
/* function*/
error_reporting(0);
function tab_out($result)
{
$stpolj=mysql_num_fields($result);
$sirina=100/$stpolj."%";
echo "<table width=100% border=0 cellpadding='2' cellspacing='2'>";
echo "<tr bgcolor=#D0D0D0>";
for ($i=0;$i<$stpolj;$i++)
{
echo "<th width='$sirina'><font size='1'> ";
echo mysql_field_name($result,$i);
echo "</font> </th>";
}
echo "</tr>";
echo "<tr>";
$num = mysql_num_rows($result);
for ($j = 0; $j < $num; $j++)
{
$row = mysql_fetch_array($result);
echo "<table width=100% border=0 cellpadding='2' cellspacing='2'>";
echo "<tr bgcolor=#00FFFF>";
for ($k=0;$k<$stpolj;$k++)
{
$fn=mysql_field_name($result,$k);
echo " <td width='$sirina'> <font size='1'> $row[$fn] </font> </td> " ;
}
echo "<tr>";
echo "</tr>";
}
echo "</table>";
}
function send_sql($db, $sql)
{
if (! $res=mysql_query($db, $sql)){
echo mysql_error();
exit;
}
return $res;
}

$sql = "select * from tecaji";
If ($res=send_sql($db,$sql)) {
echo "Poizvedba: <br> $sql"; }
tab_out($res);

Options: ReplyQuote


Subject
Written By
Posted
Hoe to call function in PHP
September 01, 2005 03:31AM
September 01, 2005 04:04AM
September 02, 2005 02:20AM
September 05, 2005 02:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.