Hello there,
so basically I’m familiar with scripting and most time I’m able to fix my things, even it it takes some hours, but now I’m out of brain.
Let’s go:
What I’m trying to do is, recreating a page with categories, (copied from source and adjusted the way to work… at least for 85%).
Whenever I’m trying to adjust a special-snippet of code, either it works to show in the webpage but without main functionallity (I’m able to click sections and see what’s in there, but can’t use the futures of the sections) or it throws out an 500 Internal Server Error with PHP Parse error: syntax error, unexpected end of file (Endline), which cannot be true, since I’ve checked it multiple times for missing ends…
Let’s show the code: (without Categories, which works like a charm:)
$queryj = mysqli_query($connect, "SELECT * FROM `crimes`");
while ($rowj = mysqli_fetch_assoc($queryj)) {
$job_id = $rowj['id'];
$querypac = mysqli_query($connect, "SELECT * FROM `player_actions` WHERE player_id='$player_id' LIMIT 1");
$rowpac = mysqli_fetch_assoc($querypac);
$countpac = mysqli_num_rows($querypac);
?>
<div class="col-md-6">
Alright, now let’s see the code which I’ve changed and it does not work.
I tried multiple adjustions, movments, it however gives me a 500 Internal Server Error, as soon as we came to Var: $firsta
<?php
$first = true;
$queryic = mysqli_query($connect, "SELECT * FROM `crime_categories`");
while ($rowic = mysqli_fetch_assoc($queryic)) {
?>
<li <?php
if ($first) {
echo 'class="active"';
$first = false;
}
?></l><a data-toggle="tab" href="#<?php
echo $rowic['id'];
?>"><i class="fa <?php
echo $rowic['fa_icon'];
?>"></i> <?php
echo $rowic['category'];
?></a></li>
<?php
}
?>
</ul>
<div class="tab-content">
<?php
$firsta = true;
$queryicc = mysqli_query($connect, "SELECT * FROM `crime_categories`");
while ($rowicc = mysqli_fetch_assoc($queryicc)) {
$category_id = $rowicc['id'];
?>
<div id="<?php
echo $category_id;
?>" class="tab-pane fade in <?php
if ($firsta) {
echo 'active';
$firsta = false;
}
?>">
<br />
<div class="row">
<?php
$queryi = mysqli_query($connect, "SELECT * FROM `crimes` WHERE category_id = '$category_id'");
while ($rowi = mysqli_fetch_assoc($queryi)) {
$item_id = $rowi['id'];
$querypic = mysqli_query($connect, "SELECT * FROM `player_actions` WHERE player_id='$player_id' LIMIT 1");
$rowpic = mysqli_fetch_assoc($querypic);
$countpic = mysqli_num_rows($querypic);
However, thank you for your time to read my problems, and hopefully respond.
EDIT: Oh no, I guess I was simple too long at that script. NVM. I found it. But if someone would want to quickly help me transfer that line to make it work without 500 Error, I would be very happy.
Error lies:
if ($countpac > 0 && $rowpac['type'] == $rowj['crime_type'] && time() >= $rowpac['finishtime']) {
echo '<a href="?finish-work=' . $rowj['id'] . '" class="btn btn-success btn-md btn-block"><i class="far fa-money-bill-alt"></i> ' . lang_key("get-salary") . '</a>';
} else if ($countpac > 0 && $rowpac['type'] == $rowj['crime_type'] && time() < $rowpac['finishtime']) {
$timeleft = secondsToWords($rowpac['finishtime'] - time());
echo '<div class="row"><div class="col-md-6"><button class="btn btn-warning btn-md btn-block disabled"><em class="fas fa-fw fa-clock"></em> ' . $timeleft . '</button></div><div class="col-md-6"><a href="?leave-work=' . $rowj['id'] . '" class="btn btn-info btn-md btn-block"><i class="fa fa-sign-out-alt"></i> ' . lang_key("leave-work") . '</a></div></div>';
} else if ($rowu['energy'] < $rowj['energy_cost'] || $rowu['health'] < $rowj['health_loss'] || $countpac > 0) {
echo '<button class="btn btn-danger btn-md btn-block" disabled><em class="fa fa-fw fa-cogs"></em> ' . lang_key("start-work") . '</button>';
} else {
echo '<a href="?job-id=' . $rowj['id'] . '" class="btn btn-info btn-md btn-block"><i class="fa fa-cogs"></i> ' . lang_key("start-work") . '</a>';
}
C.D.