I am currently receiving this error:
SyntaxError: expected expression, got '}' - line 14, col 1
In response to this code block:
<?php
include_once("base.php");
if(empty($_GET)) {
$sql = "SELECT * FROM segth";
$q = mysqli_query($link, $sql);
if ($r = mysqli_fetch_array($q)) {
echo "<table border='1'><tr><th>" . $r [1] . "</th></tr>
<tr><td>$" . $r[2] . "</td></tr><tr><td><input type='text' id='u0name' placeholder='Adjust " . $r [1] . "s Cash' onKeyPress='preupd(event, 0)' /></td></tr></table>";
}
while ($r = mysqli_fetch_array($q)) {
echo "<table class='norm' border='1'><tr><th>" . $r[1] . "</th></tr><tr><td>$" . $r[2] . "</td></tr><tr><td><input type='text' id='u0name' placeholder='Adjust " . $r [1] . "s Cash' onKeyPress='preupd(event, " . $r [1] . ")' /></td></tr></table>";
}
} else {
echo "<h1 align='center'>New Game</h1>";
echo "<table border='1'>
<tr><th>Names</th></tr>";
for($i=0;$i<8;$i++) {
echo "<tr><td><input id='u" . $i . "name' placeholder='Player " . ($i+1) . "s Name' /></td></tr>";
}
echo "<tr><td><button value='Start' onClick='strt()'>Start</button></table>";
}
?>
I have tried removing several code brackets from around the offending location, but the problem seems to be occuring around line 14 which is the same line the else
statement is below. I am currently using Notepad++ to edit this file and so I have a way to see where eah code block starts and finishes by highlighting any {
or }
and it will highlight the respective beginning or end and there are no orphans here. I just don't understand why I'm getting this error.
This error is causing my scripting to not appear if there is anything in the $_GET array, which causes problems.