Robert Granlund
asked on
PHP Variables and if statements
How do I create a variable, that includes and if statement.
How do I write this part:: if($name !="") {echo $name;} else {echo "Stranger";}
<?php
function myFunction() {
$html = '';
$query = SELECT name FROM Table_Name;
$data = $data->result_array();
foreach ($data as $row) {
$name = $row['name'];
$html. = '<div class="my-class">Hello:: '. if($name !="") {echo $name;} else {echo "Stranger";} .' How are you today?<br /></div>';
}
return $html;
}
How do I write this part:: if($name !="") {echo $name;} else {echo "Stranger";}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window