Danke super nun hab ich haber folgendes
Warning: Cannot modify header information - headers already sent by (output started at ... (test.php:1) on line 45
Warning: Cannot modify header information - headers already sent by (output started at ... (test.php:1) on line 46
Warning: Cannot modify header information - headers already sent by (output started at ... (test.php:1) on line 47
Warning: Cannot modify header information - headers already sent by (output started at ... (test.php:1) on line 48
Warning: Cannot modify header information - headers already sent by (output started at ... (test.php:1) on line 69
Quelltext:
<?php
$host = "localhost";
$user = "ich";
$pass = "meins";
$database = "die";
$connection = mysql_connect($host, $user, $pass);
mysql_select_db ($database, $connection);
$aUsers = array();
$aInfo = array();
$erg = mysql_query('SELECT * FROM title WHERE status = 1');
while ($row = mysql_fetch_assoc($erg)) {
$aUsers[] = $row['title'];
}
$input = strtolower( $_GET['input'] );
$len = strlen($input);
$aResults = array();
if ($len)
{
for ($i=0;$i<count($aUsers);$i++)
{
// had to use utf_decode, here
// not necessary if the results are coming from mysql
//
if (strtolower(substr(utf8_decode($aUsers[$i]),0,$len)) == $input)
$aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]) );
//if (stripos(utf8_decode($aUsers[$i]), $input) !== false)
// $aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]) );
}
}
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
if (isset($_REQUEST['json']))
{
header("Content-Type: application/json");
echo "{\"results\": [";
$arr = array();
for ($i=0;$i<count($aResults);$i++)
{
$arr[] = "{\"id\": \"".$aResults[$i]['id']."\", \"value\": \"".$aResults[$i]['value']."\", \"info\": \"\"}";
}
echo implode(", ", $arr);
echo "]}";
}
else
{
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?><results>";
for ($i=0;$i<count($aResults);$i++)
{
echo "<rs id=\"".$aResults[$i]['id']."\" info=\"".$aResults[$i]['info']."\">".$aResults[$i]['value']."</rs>";
}
echo "</results>";
}
?>
Wo ist der fehler, ich find ihn nicht.
Wer Rechtschreibfehler findet darf sie behalten.