Forum Moderators: coopster
i need to query a certain feild in a mysql database and if it has no value in it then prefom action but i have tried all day with no sucess on how to do this
can anyone advise
for example
$category_query = tep_db_query ("select title from " . TABLE_META_TAGS . " where categories_id = '" . $metaCategory . "'");
if title has no value in the field the echo 12345678
else
echo title
Thanks for any advise
<?php
$category_query = tep_db_query ("select title from " . TABLE_META_TAGS . " where categories_id = '" . $metaCategory . "'");
if(is_null($category_query))
{
?>
<?php
require(DIR_WS_INCLUDES . 'meta_tags.php');
?>
<?php
}
else
{
(DIR_WS_INCLUDES . 'meta_tags1.php')) {
require(DIR_WS_INCLUDES . 'meta_tags1.php');
} //else {
?>
thanks in advance
I would change your test to this
if(empty [php.net]($category_query))
that will test for different empty type values
Returns FALSE if var has a non-empty and non-zero value.The following things are considered to be empty:
"" (an empty string)
0 (0 as an integer)
"0" (0 as a string)
NULL
FALSE
array() (an empty array)
var $var; (a variable declared, but without a value in a class)