Jump to content

How to know which column name are not blank?


coder9

Recommended Posts

yo!

 

 

How to determine which column name are not blank? in a record?

and display the not empty column name?

 

let say i have this table below.

 

box1|box2|box3|box4|box5|box6|box7|box8|box9|
-------------------------------------------------
  ok |       |      | ok  |      | ok  |       |      | ok  |

 

using loop

 

thank you.

 

 

i tried this one

 

	function check_selected_box() {
	//access all field name
	$query = "SELECT * FROM jtablegrid WHERE game_no = 1"; 
	$result = mysql_query($query) or die("Problem with the query: $query on line " . __LINE__ . '<br>' . mysql_error());		
	$row = mysql_fetch_row($result);

	$i=0;
	while($i <=100) {
		if($row[$i] != '') {
			echo "user" . $row[$i];
			echo "<br>";
		}
	}		

}

 

but it display a blank page.

 

i dunno what's causing the blank display?

 

is that function that i created almost got the necessary logic.

 

All i want really is to get all the not empty column names and display there column names.

 

thanks in advance if someone will help me with this.

 

sorry i can't edit my first post for this because there is no button to edit my first post that is why i can't fix the wrong words there.

 

any help please.

 

 

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.