mehidy Posted October 16, 2012 Share Posted October 16, 2012 Hi Every one Please see below query, its getting all the check box selected row from my table, but i want to get only if col_ld_shade is not null. $details = "SELECT col_fab_bkng_ref, col_color_name, col_shade_percent, col_ld_sub_no, col_ld_sub_date, col_ld_ref, col_ld_shade, col_dying, col_color_rmks FROM tbl_color WHERE tbl_color_id IN ($ints) AND col_ld_shade IS NOT NULL"; Kindly advise. Where is the probelm? Quote Link to comment https://forums.phpfreaks.com/topic/269532-not-null-query-in-mysql-and-php-is-not-working/ Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 Can i just ask you to post all the code for this page? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/269532-not-null-query-in-mysql-and-php-is-not-working/#findComment-1385519 Share on other sites More sharing options...
mehidy Posted October 16, 2012 Author Share Posted October 16, 2012 please see below full code require("connect.php"); if (isset($_POST['tbl_color_id'])) $ints = implode(', ', $_POST['tbl_color_id']); $message = ""; $message .= " <p>Dear All<br>Please find below the comments for your ref </p>"; $message .="<table> <tr> <th>Booking ref</th><th>Color</th><th>Shade%</th><th>Lab Sub no</th><th>Lab sub date</th><th>Lab Ref</th><th>Apvd Shade</th><th>Dyeing Fact</th><th>Remarks</th> </tr>"; $details4p = "SELECT col_fab_bkng_ref, col_color_name, col_shade_percent, col_ld_sub_no, col_ld_sub_date, col_ld_ref, col_ld_shade, col_dying, col_color_rmks FROM tbl_color WHERE tbl_color_id IN ($ints) AND col_ld_shade IS NOT NULL"; $details_result4p = mysql_query( $details4p) or die ( "Couldn't get Products: ".mysql_error() ); while ( $det_row = mysql_fetch_array ( $details_result4p ) ) { // message $message .= " <tr><td> ".$det_row[ 'col_fab_bkng_ref' ]."</td> <td> ".$det_row[ 'col_color_name' ]."</td> <td> ".$det_row[ 'col_shade_percent' ]."</td> <td> ".$det_row[ 'col_ld_sub_no' ]."</td> <td> ".$det_row[ 'col_ld_sub_date' ]."</td> <td> ".$det_row[ 'col_ld_ref' ]."</td> <td> ".$det_row[ 'col_ld_shade' ]."</td> <td> ".$det_row[ 'col_color_rmks' ]."</td> </tr>";} $message .="</table>"; $message .= "<p>This is an auto generated mail, no need to reply.</p><p>Thanking you<br>noreplay@yahoo.com<br>C</p>"; $to = 'mehidy@yahoo.com' . ', '; // note the comma //$to .= 'sultan@yahoo.com'; // subject $subject = "hi"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: mehidy@yahoo.com>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/269532-not-null-query-in-mysql-and-php-is-not-working/#findComment-1385523 Share on other sites More sharing options...
Barand Posted October 16, 2012 Share Posted October 16, 2012 (edited) Are you sure some values are null and not just empty strings? Try SELECT col_fab_bkng_ref, col_color_name, col_shade_percent, col_ld_sub_no, col_ld_sub_date, col_ld_ref, col_ld_shade, col_dying, col_color_rmks FROM tbl_color WHERE tbl_color_id IN ($ints) AND col_ld_shade IS NOT NULL AND col_ld_shade <> '' Edited October 16, 2012 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/269532-not-null-query-in-mysql-and-php-is-not-working/#findComment-1385551 Share on other sites More sharing options...
mehidy Posted October 16, 2012 Author Share Posted October 16, 2012 Thanks Sir, Its working fine now. Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/269532-not-null-query-in-mysql-and-php-is-not-working/#findComment-1385579 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.