Hi guys, im trying to write some code that checks if a column heading ends with a specific letter and then highlight everything in that column.
I have a loop that prints out all data from an array of table names and would like it to highlight certain columns.
Here what I have been trying to do. Probably way off but im not sure how to go about it.
Here is what I have to print the column headings.
Have tried to add a query in there that checks if the last letter of a column ends in 'P' and if so then print it in red.
Any help would be great, thanks
I have a loop that prints out all data from an array of table names and would like it to highlight certain columns.
Here what I have been trying to do. Probably way off but im not sure how to go about it.
Here is what I have to print the column headings.
Code:
echo "<div style='font-weight:bold; color:red'>" .$tables[$i]."</div>";
// Prints the columns
echo "<table class='searchTable' border='1'; <tr>";
for($j = 0; $j < mysql_num_fields($result); $j++) {
$isP = mysql_query("SELECT * FROM ($tables[$j]) WHERE column LIKE '%P'");
$field_info = mysql_fetch_field($result, $j);
if($isP)
echo "<div style='font-weight:bold; color:red'>" .$field_info."</div>";
else
echo "<th>{$field_info->name}</th>"; }
Have tried to add a query in there that checks if the last letter of a column ends in 'P' and if so then print it in red.
Any help would be great, thanks