Count Number of Columns That Are Not Empty:PHP MYSQL

Hello friends,
I have written the following script to count the columns which are not empty.
In the following script i have taken a scenario where student’s batch-days are supposed to be counted.

 

<?php
$sql="SELECT sum((monday_time_from IS NOT NULL and monday_time_from <> '') +
(tuesday_time_from IS NOT NULL and tuesday_time_from <> '') +
(wednesday_time_from IS NOT NULL and wednesday_time_from <> '') +
(thursday_time_from IS NOT NULL and thursday_time_from <> '') +
(friday_time_from IS NOT NULL and friday_time_from <> '') +
(saturday_time_from IS NOT NULL and saturday_time_from <> '') +
(sunday_time_from IS NOT NULL and sunday_time_from <> '')) as total
from batches WHERE student_id='$student_id' ";

//change monday_time_from,tuesday_time_from,... with your column names
$result = mysql_query($sql);
$data=mysql_fetch_assoc($result);
echo $number_of_days=$data['total'];

?>

235 thoughts on “Count Number of Columns That Are Not Empty:PHP MYSQL

  1. Pingback: Google
  2. Pingback: Google
  3. Pingback: 토토사이트
  4. Pingback: 사다리사이트
  5. Pingback: 안전놀이터
  6. Pingback: 먹튀검증
  7. Pingback: ventrilopo
  8. Pingback: silicone vibrators
  9. Pingback: vibrator for women
  10. Pingback: double dildos
  11. Pingback: смотрите
  12. Pingback: beast tv apk
  13. Pingback: item shop
  14. Pingback: big double dong
  15. Pingback: порно чат
  16. Pingback: 먹튀그램
  17. Pingback: cursos online
  18. Pingback: fbv cursos grátis
  19. Pingback: Google
  20. Pingback: Google
  21. Pingback: Judi online
  22. Pingback: raiders
  23. Pingback: bondage toys
  24. Pingback: Deals on goods
  25. Pingback: FIFA 19 Coins
  26. Pingback: g spot vibrator
  27. Pingback: silicone wand
  28. Pingback: Detroit SEO
  29. Pingback: Chicago SEO
  30. Pingback: multqa.ae
  31. Pingback: cursos online
  32. Pingback: magic massager
  33. Pingback: curve massager
  34. Pingback: chwilówki
  35. Pingback: iphone repair nyc
  36. Pingback: penis rings
  37. Pingback: vibrato lesson
  38. Pingback: Porn City
  39. Pingback: panty vibrator
  40. Pingback: suction cup dildo
  41. Pingback: find a brides site
  42. Pingback: data entry jobs
  43. Pingback: los angeles seo
  44. Pingback: xxnxx
  45. Pingback: Rabbit Vibe
  46. Pingback: best anal toys
  47. Pingback: penis pump
  48. Pingback: anal
  49. Pingback: strapless dildo
  50. Pingback: fun88
  51. Pingback: 188bet
  52. Pingback: pc app
  53. Pingback: penis pump
  54. Pingback: sekscamera
  55. Pingback: sexy gatas na web
  56. Pingback: rencontres sexe
  57. Pingback: anal trainer
  58. Pingback: speelgoed kopen
  59. Pingback: pc app
  60. Pingback: hamptonbaylight
  61. Pingback: cursos gratuitos
  62. Pingback: Times of India
  63. Pingback: dani pussy
  64. Pingback: shemale dating
  65. Pingback: webcambabes
  66. Pingback: wireless anal plug
  67. Pingback: dildo and balls
  68. Pingback: male masturbator
  69. Pingback: anal vibrator
  70. Pingback: sex toy store
  71. Pingback: gay anal toys
  72. Pingback: massive dildo
  73. Pingback: strap ons
  74. Pingback: top male stroker
  75. Pingback: male pump
  76. Pingback: new dildo
  77. Pingback: vibrator for her
  78. Pingback: 7 inches dong
  79. Pingback: bum plugs
  80. Pingback: Tadapox
  81. Pingback: realistic vibrator
  82. Pingback: app testing job
  83. Pingback: glands ring
  84. Pingback: dildos
  85. Pingback: erotic vibrator
  86. Pingback: big dildo reviews
  87. Pingback: blockchain advisor
  88. Pingback: satta matka
  89. Pingback: pocket masturbator
  90. Pingback: mini egg vibrator
  91. Pingback: male stoker review
  92. Pingback: g spot orgasm
  93. Pingback: vagina dilator
  94. Pingback: anal butt plugs
  95. Pingback: porn
  96. Pingback: pornland
  97. Pingback: gay briefs
  98. Pingback: powerdirector app
  99. Pingback: how to suck cock
  100. Pingback: mountain bikes
  101. Pingback: pocket stroker
  102. Pingback: rubbish bin hire
  103. Pingback: legal
  104. Pingback: real dildo
  105. Pingback: sex toy collection
  106. Pingback: spanking paddle
  107. Pingback: bullet vibe
  108. Pingback: brisbane web
  109. Pingback: gips mallen
  110. Pingback: 15% minoxidil
  111. Pingback: Cialis
  112. Pingback: hundeseng i plast
  113. Pingback: discover here
  114. Pingback: Julia Ann
  115. Pingback: bdjob
  116. Pingback: Fashion Station
  117. Pingback: Pakistani Suits
  118. Pingback: Pool Supplies
  119. Pingback: sexboer
  120. Pingback: porno files
  121. Pingback: geile sex filmpjes
  122. Pingback: gratis films
  123. Pingback: pornofilmpjes
  124. Pingback: liteblue login
  125. Pingback: liteblue
  126. Pingback: maxi wanachi
  127. Pingback: virtual Mastercard
  128. Pingback: finger vibrator

Leave a Reply