I am trying to get this php code to run and I am getting an error that says "PHP Parse error: syntax error, unexpected $end in /var/www/TestSite1/betting.php on line 54", I checked multiple times that I closed all of the brackets, quotations, and semicolons. Any help would be greatly appreciated.
<form action="index.php" method="post">
Person: <select name="person">
<option value="Karl">Karl</option>
<option value="Erik">Erik</option>
<option value="Patrick">Patrick</option>
</select>
Money: <input type="text" name="am"><br>
Pass: <input type="text" name="pass"><br>
<input type="submit">
</form>
<?php
$person=$_POST["pass"];
$money=$_POST["am"];
class MyDB extends SQLite3
{
function __construct()
{
$this->open('betting.db');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
echo "Opened database successfully<br>";
}
if ($passwd == '3nt3rpr1s3'){
print "Correct Password<br>";
$sql =<<<EOF
UPDATE people set money = "$money" where person=$pname;
EOF;
} else {
print "\nIncorrect Password!";
}
$ret = $db->exec($sql);
if(!$ret){
echo $db->lastErrorMsg();
} else {
}
$sql =<<<EOF
SELECT * from people;
EOF;
$ret = $db->query($sql);
while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
echo "<br>ID = ". $row['id'] . "\n";
echo "<br>Person = ". $row['person'] . "\n";
echo "<br>Money = ". $row['money'] . "\n";
}
$db->close();
?>
}
; but could be the spaces before yourEOF;
at the end of your heredocs – Mark Baker Mar 15 '14 at 22:26EOF;
--- Least, that's what my IDE tells me. – Fred -ii- Mar 15 '14 at 22:37