Jump to content

display data in a table


vang163

Recommended Posts

function displayData($tableName)

{

$sql = "SELECT * FROM $tableName";

$result = mysql_query($sql) or die("Query Failed.");

$count = mysql_num_rows($result);

$number_of_column = mysql_num_fields($result);

 

if ($count == 0)

{ echo 'No matches of your criteria.';

}

else if ($count > 0)

{ for($j = 0; $j < $count; $j++)

{ echo "  <tr>\r";

for($i = 0; $i < $number_of_column; $i++)

{ echo "    <td>" . mysql_fetch_row($j, $i) . "</td>\r";

}

echo "  </tr>\r";

}

}

}

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.