In my controller:
public function view($id = null) {
$recipe_url = $this->fetchTable('Recipes')->find('list')->select(['url'])->where(['Recipes.user_id' => $id])->first();
$this->set('recipe_url', $recipe_url);}
In my view template:
if (!isset($recipe_url) || empty($recipe_url) || $recipe_url="NULL" || $recipe_url="") {echo "This cook has no links to online recipes yet.";}
echo $recipe_url; //FOR TESTING
I am trying to get the record for the url field in the Recipes table but my $recipe_url query returns the number 1 whether there is an url field present or not. I would expect to get 0 if the url field isnât set and a string if it is set but my echo $recipe_url; statement in the template prints the number 1 no matter whether the url field is set or not. And the statement âThis cook has no links to online recipes yet.â prints out both when the url is set and when it isnât set.