How to hide mysqli null row

I have the following code and i need to hide area2 and adsec2 if in my mysql table are empty.

here is my code

while($row = mysqli_fetch_array($resultFilmCerts)) { echo "\t<tr><td>".$row['pn']."</td><td>".$row['fname']."</td><td>".$row['lname']."</td><td>".$row['careerin']."</td><td>".$row['careerout']."</td><td>".$row['area1']."-".$row['adsec1']."<br>".$row['area2']."-".$row['adsec2']."</td><td>View <i>thematic </i>career</td></tr>\n"; }

--------------Solutions-------------

check for null.

while($row = mysqli_fetch_array($resultFilmCerts)) {

$area1 = ($row["area1"] == null ? "" : $row["area1"]);
$adsec1 = ($row["adsec1"] == null ? "" : $row["adsec1"]);

add these two lines above your echo statement.

echo "\t<tr><td>".$row['pn']."</td><td>".$row['fname']."</td><td>".$row['lname']."</td><td>".$row['careerin']."</td><td>".$row['careerout']."</td><td>".$area1."-".$adsec1."<br>".$row['area2']."-".$row['adsec2']."</td><td>View <i>thematic </i>career</td></tr>\n";

I think you need to apply relation between your tables. Then use LEFT JOIN. In received data from query, hide td (with colspan if necessary) if value is null or unavailable.

i hope it will help you..With the of this you can count the numbers of rows from database.

$rowcount=mysqli_num_rows($result); if($rowcount>0){ //diplasy your data}else{ }

Category:php Time:2018-11-29 Views:1

Related post

  • How to hide a table row that has no unique id 2010-10-07

    How to hide a table row that has no unique id, but row just contains TD with a specific text, note that I cannot adjust the classnames or add ID's there either. Its nested TR. eg. <tbody><tr> <table id="baskettable"><tbody>

  • how to hide the particular row in the Gridview? 2010-08-25

    How can I hide a particular row in a GridView? For Example If I click 2/4/1/7 it will hide 3/5/2/8 correspodingly how to do this --------------Solutions------------- You could try something like this YourDataGridView.CurrentCell = null; YourDataGridV

  • How to delete mysql db rows remotely? 2009-11-11

    Can I run mysql delete row remotely from other machine? Something alike mysqldump which run locally dumping data on other remote machine. --------------Solutions------------- try: mysql -u yourdblogin -pyourdbpassword -h yourdbdomain.yourdomain.com y

  • How do I exclude null rows without excluding null cells when pulling Excel into C# using SQL (ADO)? 2010-02-03

    I have a query like the following: SELECT * FROM OPENROWSET('MSDASQL', 'Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\test.xls','SELECT * FROM Sheet1$]') This brings back rows that are all null if they were ever edited and then deleted. I want to ex

  • How to hide/show table rows using jQuery? 2009-12-20

    I have a Zend Framework (PHP) web application that has a table with a lot of rows. 99.9% of the time, the user will take action on the first or second row. 00.1% of the time, the user will need to go back and take action on a different row. So I only

  • In Access 2003 Report, how to hide some detail rows? 2011-06-27

    I'm working up an MS Access report. This report is grouped and has a details section. But some of these details rows don't need to be shown. How do I hide the details sections if, for example, "[fieldx] = 'foo'"? (In Crystal Reports, there's a place

  • How to display a null row between 2 tables 2012-11-07

    Using a view in SQL Server 2000 Table1: id z1 z2 z3 z4 type -------------------------------------- 01A 300 400 300 400 01 2B 300 400 300 500 02 3C 700 600 400 300 01 04A 500 400 800 900 01 05B 400 300 400 300 02 06 150 200 200 150 03 .... Table2: typ

  • How to Pass MySQL null parameter on DbCommand in Enterprise Library 2008-11-13

    I'm trying to pass a null value for the first parameter in the code below, but MySQL complains that Incorrect number of arguments for PROCEDURE myProc; expected 2, got 1 When I manually call the procedure with the first argument as null, it works, bu

  • How to hide a table row in jQuery? 2009-06-26

    I have a table such as this <table class="headerTable" id="headerTable"> <tbody> <tr class="hh"> <td>test1</td> <td>18,164</td> </tr> <tr class="member"> <td>test3</td> <td>24,34

  • How to Filter out null rows from DataTable with linq? 2010-03-07

    I have a Datable that I have built from excel data, but sometimes excel returns rows in which all the fields are null. I'd like to filter these out generically without regard for column names. I think Linq would do this nicely but having a bit of tro

  • DataGridView - how to hide the "new" row? 2010-08-08

    My DataGridView is read-only - the user cannot enter data into it, so that empty row at the end (the "new" row?) just looks ugly. How can I prevent it from displaying? --------------Solutions------------- On the form designer view, click the little a

  • How to hide the empty row in a ListView? 2011-03-09

    I have a listview and I add many items into that list. However, when I scroll down to the last item, there's an empty row. I don't know how to get rid of it. Thanks This is the picture of it --------------Solutions------------- I noticed the empty sp

  • How to save MySQL count() row into an PHP array? 2011-11-05

    Hello i want to save one row which comes out of a MySQL database with "count('row1'') AS sum" but inside my array i only got empty fields! Database query: "SELECT id, value, COUNT('value') AS sum FROM answer_user GROUP BY id,value" php code: $result

  • How to hide and unhide rows in excel tab using VBA Macro when the values in the range change with data validation parameters 2014-07-26

    Hi , I have a report where in i want to hide the rows which has zero appearing as value ( due to formula calculation ) , the rows should unhide automatically as i change the data validation in cells AE8 , AE9 from one parameter to another parameter.

  • How do I exclude NULL rows from join result 2014-10-26

    Below are the tables t1 and t2 that I want to generate the output table from. My struggle was to not include in the output the rows where y1 is NULL. +--------------+ +--------------+ | t1 | | t2 | +--------------+ +--------------+ | x0 | x1 | x2 | |

  • Remove "NULL rows" from a String array using LINQ 2009-12-21

    How would you remove "NULL rows" from a String array using LINQ? Take this structure (String[,]): "Hello", "World", "Foo", "Bar" null, null, null, null null, null, null, null "Hello", "World", "Foo", "Bar" "Hello", "World", "Foo", "Bar" null, null, "

  • How can I remove all rows that aren't the newest N for each user in MySQL? 2009-04-02

    Assuming I have a table foo where I have something like this: id, user_id, timestamp, some_value What I want to do is remove all rows that aren't the newest N per user. The deletion itself could be handled by a: DELETE FROM foo WHERE id NOT IN (...)

  • MySQL: How to get n latest rows of a distinct type 2009-06-04

    Putting this as simply as I can, I have the following table structure: Date | Type | Title Say Type is a value in the range 1-10, I have 1,000s of records in the table, and I want the 5 most recent records of unique type. So the result would be somet

  • How to select unique arrays from MySQL table row? 2010-08-05

    I have a table with 20 rows and one row have for example: 2,3,5,6,8,22 2,3,5,6,8,22,44,55 etc. How can I select from mysql table rows only unique numbers, not duplicated so results are: 2,3,5,6,8,22,44,55 The table definition: CREATE TABLE IF NOT EXI

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 2.108 (s). 15 q(s)