Hi, I’m getting this error from my template page:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\Web Data\divdev\templates\frontend\centerlisting.tpl on line 19
The code is:
[php]
<?php echo $lists['directory']; ?>
<?php
$link = mysqli_connect($host, $user, $pass, $db);
if (!$link) {
$msg = $error['dbconnect'];
$page = 'index.php';
header("Location: ../templates/backend/error.php?msg=$msg&page=$page");
}
[/php]
$sql = "SELECT * FROM categories";
$result = mysqli_query($link, $sql);
if ($result) {
while ($row = mysqli_fetch_assoc($result)) {
if ($row['cat_id'] <> 0) {
$sql = "SELECT * FROM links WHERE comp_cat = $row['cat_id']";
$res = mysqli_query($link, $sql);
if (mysqli_errno($link)) {
echo mysqli_error($link);
}
$rows = mysqli_num_rows($res);
echo "-> " . $row['cat_name'] . " (" . $rows . ")";
}
}
} else {
$msg = $error['dbselect'] . mysqli_error($link);
$page = 'index.php';
header("Location: ../templates/backend/error.php?msg=$msg&page=$page");
}
mysqli_free_result($result);
mysqli_free_result($res);
mysqli_close($link);
?>
</div>
This is line 19: $sql = "SELECT * FROM links WHERE comp_cat = $row['cat_id']";
I spent hours trying to find the problem. Can someone help me, Please?