I write PHP and ActionScript and connect them but result error
Here is the ActionScript
var filepath:String;
if (_url.indexOf("http") != 0) filepath = "http://localhost/adaptasi/";
else filepath = "../scripts/";
var send_lv:LoadVars = new LoadVars();
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean):Void {
TextIsi1.text = result_lv;
}
send_lv.sendAndLoad(filepath + "morfologi.php", result_lv, "GET");
And here is the PHP
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "adaptasi";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM materi";
$result = mysqli_query($conn, $sql);
{
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
and the result is error: Error SELECT * FROM materi & onLoad= type Function