How do you replace a NULL value in the select with an empty string? It doesnt look very professional to output \"NULL\" values.
This is very unusual and based on my synt
Try this, this should also get rid of those empty lines also:
SELECT prereq FROM test WHERE prereq IS NOT NULL;
Try below ;
select if(prereq IS NULL ," ",prereq ) from test
I have nulls (NULL as default value) in a non-required field in a database. They do not cause the value "null" to show up in a web page. However, the value "null" is put in place when creating data via a web page input form. This was due to the JavaScript taking null and transcribing it to the string "null" when submitting the data via AJAX and jQuery. Make sure that this is not the base issue as simply doing the above is only a band-aid to the actual issue. I also implemented the above solution IFNULL(...) as a double measure. Thanks.
If you really must output every values including the NULL ones:
select IFNULL(prereq,"") from test
I know this is old question but i got best solution without change query and also support for SELECT * statement
foreach ($row as &$value) {
if($value==null){
$value="";
}
}
UPDATE your_table set your_field="" where your_field is null