PHP: codecomments inside functions prevents it work
Posted
by
Karem
on Stack Overflow
See other posts from Stack Overflow
or by Karem
Published on 2011-01-11T14:47:26Z
Indexed on
2011/01/11
14:53 UTC
Read the original article
Hit count: 260
php
$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
© Stack Overflow or respective owner