I'm just trying to get some data through a table in a specific row.
Here's my script.
<?php
$con=mysqli_connect("localhost","root","","astralms");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$type = htmlspecialchars(mysql_real_escape_string($_GET['type']));
$username = htmlspecialchars(mysql_real_escape_string($_GET['username']));
$result = mysqli_query($con,"SELECT * FROM accounts
WHERE name = '%s', $username);
while($row = mysqli_fetch_array($result))
{
if($type == "nxcash") {
echo $row['ACash'];
} else if($type == "votepoints") {
echo $row['vpoints'];
} else if ($type == "gmlevel") {
echo $row['gm'];
}
}
?>
However, I get:
( ! ) Parse error: syntax error, unexpected 'nxcash' (T_STRING) in C:\wamp\www\accountdata.php on line 17.
when using it like 127.0.0.1/accountdata.php?username=tester&type=votepoints
Thanks.