PHP: codecomments inside functions prevents it work
- by Karem
$query = $connect->prepare("SELECT firstname, lastname FROM users WHERE id = '$id'");
$query->execute();
$row = $query->fetch();
// $full_name = $row["firstname"] . " ".$row["lastname"];
$full_name = $row["firstname"] . " ".substr($row["lastname"], 0, 1).".";
return $full_name;
If i remove the line that is a comment ( // ), it will return $full_name, if its there then it wont work. I also tried commenting with #, but it still wont work(wont return anything) as soon as there is a codecomment
weird issue