Month: March 2018

select rows and ignore row if column value is blank or null in MySQL

For many case we need to select all row value and ignore if column value is null or empty in MYSQL , in this case you can do this easily . This is simple code which help you.


Option 1 :

You need to check that column value empty or null

SELECT * FROM your_table where column_name IS NOT NULL or column_name != ''; // column_name is your field name


Option 2 :

You could use COALESCE() to treat blank (empty string) and NULL as the same thing:

SELECT * FROM your_table WHERE COALESCE(column_name, '') != '';

you can also do this in your php code section .

Option 3 :

$column_name = $row_Recordset1['column_name'];
if($column_name == '' || $column_name === null || is_null($column_name)){
   continue;
}

if you need any help then please inform me, i will try to help you

Comment

php intval sometime decrease result

If you want to divide value need result as int then normally we use intval function but some case it give wrong result. This is simple code which result wrong

<?php
echo  intval(69.6  / .1);
?>

Then final result is :

 Result :695 // which is wrong 
 Result will be : 696

so in this case first we need to make round value result then convert int, this is demo code which will work

<?php
echo  intval(round(69.6  / .1),2);
?>

then the result is :

Result is : 696 // which is correct

So if you divide something then need result as int then use round function

Comment

how to change the style of alert box?

Now we want to change website more style so normal alert box is not good to see so in this case we want to change it.
There are some library which help you a lot. This is some link which you can use

Option 1: You can use

There are lot of option to customize it. hope you will like it

Option 2 : you can also use

This is very cool and more option to customize

If you need any help then please inform me, i will try to help you

Comment