Hi,
I get an error 'Error opening URL 'http://localhost/PhpProject2/index.php' while I try a database connection using PHP from the AS 2.0. Otherwise sending and receiving data works fine between the AS and the PHP.
Below are my AS 2.0 and PHP codes:
result_lv = new LoadVars();
data_lv = new LoadVars();
data_lv.num1 = 98;
data_lv.num2 = 45;
result_lv.onLoad = function (success)
{
if (success)
{
for( var prop in this )
{
trace (" key " + prop + " = " + this[prop]);
}
}
else
{
trace("Cannot call the PHP file...");
}
}
result_lv.onData = function(dataReceived)
{
trace(dataReceived);
}
data_lv.sendAndLoad("http://localhost/PhpProject2/index.php", result_lv, "POST");
<?php
$fVar1 = $_POST['num1'];
$fVar2 = $_POST['num2'];
$connect = mysql_connect('localhost','root','root');
$dbselect = mysql_select_db('test',$connect);
$query = mysql_query('SELECT name FROM testtable where Id = 2');
if (!$connect or !$dbselect or !$query)
{
echo('failed=true');
}
else
{
echo ('true');
}
?>
Please help.
Regards,
Supriya Tenany




