HI Guys,
I have following problem. I'm trying to connect from my Iphone app to a php site, to access the mySql db, to get the right information.
This is my code:
<?php
mysql_connect ("localhost", "user", "pass") or die (mysql_error());
echo "Connected to MySql <br /><hr />";
mysql_select_db ("database_com") or die (mysql_error());
echo "Connectted to Database <br /><hr />";
$country = $_POST['country'];// THIS IS THE VALUE I WANT TO LOAD INTO THE SELECT STATEMENT
echo "value <br /><hr />" . $country;
$query = "SELECT * FROM world WHERE land='$country'";
$result = mysql_query($query) or die (mysql_error());
while ($row = mysql_fetch_array($result)) {
$1 = $row['1'];
$2 = $row['2'];
$3 = $row['a3'];
$4 = $row['4'];
$xmltext = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<country></country>";
$xmlobj = simplexml_load_string($xmltext);
$xmlobj->addChild("1", $1);
$xmlobj->addChild("2", $2);
$xmlobj->addChild("a3", $a3);
$xmlobj->addChild("4", $4);
print header("Content-type: text/plain") . $xmlobj->asXML(); // Place future code ABOVE this line
$xml->save(statistic.xml);
}
?>
If I hardcode the value of land = "Germany" i get an answer, but if I do the other thing, nothing comes out of it.
I hope u can help me.