इसे आजमाएं:
$result = mysqli_query($conn, "SELECT * FROM $dbname.statusinfo WHERE soid = '$userinput1' AND date_column <> '0000-00-00' ") or die(mysqli_error($conn));
हालाँकि, mysql के साथ आप ऐसा करने में भी सक्षम हो सकते हैं:
$result = mysqli_query($conn, "SELECT * FROM $dbname.statusinfo WHERE soid = '$userinput1' AND date_column > '0000-00-00' ") or die(mysqli_error($conn));
आशा है कि यह मदद करता है
संपादित करें
मैं देख सकता हूं कि अब आप क्या चाहते हैं कि आपने प्रश्न में संशोधन किया :) दुर्भाग्य से मुझे एसक्यूएल का उपयोग करने के तरीके के बारे में पता नहीं है (कोई भी कर सकता है)।
आप कॉलम हेडिंग को आउटपुट कर रहे हैं और इसलिए किसी विशेष कॉलम को आउटपुट नहीं करने से वे गलत कॉलम में दिखाई देंगे, इसलिए आपको कुछ भी आउटपुट नहीं करना होगा जहां समय है 0000-00-00
हालांकि मैं इसे PHP में कैसे करूंगा। (और अगर मैं आपकी बात फिर से चूक गया तो मैं खुद को गोली मार सकता हूं :))
<?php
$userinput1 = $_POST['soid'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "status";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_errno) {
printf("Connect failed: %s\n", $conn->connect_error);
exit();
}
$result = mysqli_query($conn, "SELECT * FROM $dbname.statusinfo WHERE soid = '$userinput1' ") or die(mysqli_error($conn));
$arrayHeadings = array(
"dept" => "Department",
"samplerecived" => "Sample Recived",
"molbioextraction" => "Mol-Bio Extraction",
"molbioextractionqc" => "Extraction QC",
"libraryprep" => "Library Prep",
"libraryqc" => "Library QC",
"sequencing" => "Sequencing",
"datacheck" => "Data Check",
"resequencing" => "RE Sequencing",
"qccheck" => "QC Check",
"analysisstarted" => "Analysis Started",
"analysiscompleted" => "Analysis Completed",
"report" => "Report",
"outbound" => "Outbound",
);
?>
<style>
th{
color: blue;
}
td{
color: black;
}
</style>
<table border='1'>
<tr>
<?php foreach($arrayHeadings as $key => $name): ?>
<th><?= $name; ?></th>
<?php endforeach; ?>
</tr>
<tr>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<?php foreach($arrayHeadings as $key => $name): ?>
<?php if($row[$key] != "0000-00-00"): ?>
<td><?= $row[$key]; ?></td>
<?php else: ?>
<td></td>
<?php endif; ?>
<?php endforeach; ?>
<?php endwhile; ?>
</tr>
</table>
संपादित करें
यदि फ़ील्ड में 0000-00-00 है तो तालिका शीर्षक आउटपुट नहीं हैं। यह एक समय में केवल एक तत्व के आउटपुट होने पर निर्भर करता है।
<?php
$userinput1 = $_POST['soid'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "status";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_errno) {
printf("Connect failed: %s\n", $conn->connect_error);
exit();
}
$result = mysqli_query($conn, "SELECT * FROM $dbname.statusinfo WHERE soid = '$userinput1' ") or die(mysqli_error($conn));
$arrayHeadings = array(
"dept" => "Department",
"samplerecived" => "Sample Recived",
"molbioextraction" => "Mol-Bio Extraction",
"molbioextractionqc" => "Extraction QC",
"libraryprep" => "Library Prep",
"libraryqc" => "Library QC",
"sequencing" => "Sequencing",
"datacheck" => "Data Check",
"resequencing" => "RE Sequencing",
"qccheck" => "QC Check",
"analysisstarted" => "Analysis Started",
"analysiscompleted" => "Analysis Completed",
"report" => "Report",
"outbound" => "Outbound",
);
?>
<style>
th{
color: blue;
}
td{
color: black;
}
</style>
<table border='1'>
<tr>
<?php foreach($arrayHeadings as $key => $name): ?>
<?php if($row[$key] != "0000-00-00"): ?>
<th><?= $name; ?></th>
<?php endif; ?>
<?php endforeach; ?>
</tr>
<tr>
<?php while($row = mysqli_fetch_assoc($result)): ?>
<?php foreach($arrayHeadings as $key => $name): ?>
<?php if($row[$key] != "0000-00-00"): ?>
<td><?= $row[$key]; ?></td>
<?php endif; ?>
<?php endforeach; ?>
<?php endwhile; ?>
</tr>
</table>