I have the header at the very beginning of my script and so I've no idea why I'm getting this error, anyone have any other ideas? im trying to send an email later in the script but it contains czech characters.
<?php
ob_start();
header('Content-Type: text/plain; charset=Windows-1252;');
$dayofweek = getdate();
if($dayofweek[weekday] == "Friday") {
die(0);
/*} elseif($dayofweek[weekday] == "Saturday") {
die(0); */
} else{
$aCSVFile = 'filepath';
if(file_exists($aCSVFile)) {
echo("$dayofweek[weekday]");
$connect = mysql_connect("localhost","dbname","dbpass");
echo("\n connected to sql");
mysql_select_db("dbname",$connect);
echo("\n connected to db");
$convertNow = mb_convert_encoding($aCSVFile, 'UTF-8', 'auto');
$handle = fopen($convertNow,"r");
echo("\n file opened");
//loop through the csv file and insert into database
do {
if ($data[0]) {
mysql_query("INSERT INTO bakery_items(UserID, Order_status, Date_from, Date_until, Product_ID, Product_quantity, OrderID) VALUES
(
'$data[0]',
'$data[1]',
'$data[2]',
'$data[3]',
'$data[4]',
'$data[5]',
'$data[6]'
)
");
}
} while ($data = fgetcsv($handle,1000,",","'"));
unlink($aCSVFile);
$fileToSendPath = 'somefilepath';
$fileToSend = fopen($fileToSendPath,'w');
$Cmdbase = "base string";
if($dayofweek[weekday] != "Thursday") {
$Cmdbase = "SELECT Product as PRODUKT, Total as POČET FROM ORDER_LIST";
} else {
$Cmdbase = "SELECT Product as PRODUKT, Total as POČET FROM ORDER_LIST_WKND";
}
$sql = mysql_query($Cmdbase);
while($row = mysql_fetch_array($sql))
{
$user = $row['PRODUKT'];
$pass = $row['POČET'];
$accounts = "$user:$pass \n";
fwrite($fileToSend, $accounts);
}
$bodytext = "Dobrý Den, Posíláme vám náše obědnavku pro nasledujici den, děkujeme.";
/*$bodytext = mb_convert_encoding($Bodytxt,'HTML-ENTITIES', 'Windows-1252');*/
fclose($fileToSend);
echo('file created');
require_once('wp-includes/PHPMailer-master/class.phpmailer.php');
$email = new PHPMailer();
$email->From = 'myemail@email.cz';
$email->FromName = 'Broodjes';
$email->Subject = 'Obědnavka od ';
$email->Body = $bodytext;
$email->AddAddress('soso@hotmail.com' );
$file_to_attach = 'someFilePath';
$email->AddAttachment( $file_to_attach , 'Obednavka_NaVenkove.txt' );
return $email->Send();
echo('file sent');
unlink($fileToSendPath);
}
} ?>
ob_start(); gives the same error really unsure of how to do it, I don't know if it makes a difference but there is an instance of wordpress installed but the script is created by myself not working I've updated my code in the question to give you all