php - How to get the column name of the cell which returned by result::fetch_row if I use foreach on it? -


i have created simple php code print result of mysqli query no matter query , how many columns , rows in there. simplified php code is:

$result = $mysqli->query ($query); while ($row = $result->fetch_row()) {    if ($row["status"] == "0") continue;    foreach ($row $cell) {        echo $cell;    }    echo "\n"; } 

now want omit column (ex: column named "status") printed, have include column "status" in query because need check "status" value determine whether if entire row printed or not (the check little more complicated , it's impractical on query itself). if row printed, don't want column "status" printed along in table. have no means know whether $cell inside foreach named "status" or not, , have several other columns have similar value "status" can't check based on value either. how can this? i've read on php mysqli::fetch_row() manual doesn't seem each of $cell object can applied method ask what's column name. thanks.

so select rows status !=0

select a,b,c user status!=0; 

update:

unset($row["status"]); var_dump($row); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -