My current code is this:
<?php
$con=mysqli_connect("stevie.heliohost.org","rbxdataa_Art","mydata123art");
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
mysqli_select_db($con, "rbxdataa_Data");
$Amount=$_GET["Amount"];
$GetType=$_GET["Type"];
$sql = "SELECT * FROM EventRecord WHERE EventType='$GetType' ORDER BY EventId DESC";
$sql_run = mysqli_query($con, $sql);
while($sql_row = mysqli_fetch_assoc($sql_run)){
echo $sql_row['EventId'].'<br>';
}
mysqli_close($con);
?>
As I am currently very new to PHP and MySQL, I have no idea why this code will not work. I am also confused as to how I would make it echo only the top ($Amount) as determined by how large the "EventId" value is. My intent is to gather the [$Amount] highest rows in the table with the EventType $GetType. I am aware of SQL Injection vulnerability, however for my purposes this does not affect me. Error: "Parse error: syntax error, unexpected T_STRING on line 4"