As soon as I try to add single-line comments (e.g // comment) it prevents any of the functions following the comment from running.
Yesterday, with the same code on the same server, this was not an issue, and as soon as I remove the comment the code runs perfectly.
The code also runs perfectly if I use multi-line comments instead (e.g /* comment */).
What I would like to ask is if anyone knows why this is happening and if there is anything I can do to stop the single-line comments from affecting my code?
Are there any settings that affect this?
Has anyone encountered this problem before?
Example:
<?php
session_start();
require_once('includes.php');
page_header('Task List');
page_navigation('tasklist.php', $dbh);
echo 'Success -1';
/* Comment */
$stmt = $dbh->prepare("SELECT * FROM task WHERE user_id = ? ORDER BY priority ASC");
echo 'Success 0';
// If the user is admin use the chosen client_id
if($_SESSION['user']['user_id'] === '1'){
$stmt->execute(array($_SESSION['client_id']));
echo 'Success 1';
}else{
// Otherwise use the user's user_id
$stmt->execute(array($_SESSION['user']['user_id']));
echo 'Success 2';
}?>
Success -1 and Success 0 are both echoed, but anything after the single-line // comment does not run. If I take the comment away, it runs and Success 1 is also echoed.