SQL查询中的问题 [英] problem in sql queries
问题描述
为什么我会收到这些错误????
以Excel格式下载此报告
警告:无法修改标头信息-第12行的C:\ xampp \ htdocs \ import \ export2.php中已经发送过的标头(输出从C:\ xampp \ htdocs \ import \ OPTION2.PHP:4开始)
警告:无法修改标头信息-第13行的C:\ xampp \ htdocs \ import \ export2.php中已经发送过的标头(输出从C:\ xampp \ htdocs \ import \ OPTION2.PHP:4开始)
警告:无法修改标头信息-第14行的C:\ xampp \ htdocs \ import \ export2.php中已经发送过的标头(输出从C:\ xampp \ htdocs \ import \ OPTION2.PHP:4开始)
警告:无法修改标头信息-第15行的C:\ xampp \ htdocs \ import \ export2.php中已经发送过的标头(输出从C:\ xampp \ htdocs \ import \ OPTION2.PHP:4开始)
id日期mobno状态类型电话呼叫器
Why I am getting these errors???
Download this report as Excel
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\import\OPTION2.PHP:4) in C:\xampp\htdocs\import\export2.php on line 12
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\import\OPTION2.PHP:4) in C:\xampp\htdocs\import\export2.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\import\OPTION2.PHP:4) in C:\xampp\htdocs\import\export2.php on line 14
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\import\OPTION2.PHP:4) in C:\xampp\htdocs\import\export2.php on line 15
id date mobno state type telecaller
<?php
include 'connection.php';
include 'option2.php';
function export_excel_csv()
{
$sql = "SELECT id,date,mobno,state,type,telecaller FROM temp1 WHERE
(date='$_POST[select]' OR telecaller='$_POST[select1]\r') ORDER BY id ASC ";
$rec = mysql_query($sql) or die (mysql_error());
$num_fields = mysql_num_fields($rec);
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=reports.xls");
header("Pragma: no-cache");
header("Expires: 0");
for($i = 0; $i < $num_fields; $i++ )
{
$header = mysql_field_name($rec,$i)."\t";
print "$header";
}
print "\n";
while($row = mysql_fetch_row($rec))
{
$line = '';
foreach($row as $value)
{
if((!isset($value)) || ($value == ""))
{
$value = "\t";
}
else
{
$value = str_replace( '"' , '""' , $value );
$value = '"' . $value . '"' . "\t";
}
$line .= $value;
}
$data = trim( $line ) . "\n";
print "$data";
}
print "\n";
$data = str_replace("\\r" , "" , $data);
if ($data == "")
{
$data = "\\n No Record Found!\n";
}
}
export_excel_csv();
?>
推荐答案
sql = 在temp1中选择id,日期,mobno,状态,类型,电话 (date ='
sql = "SELECT id,date,mobno,state,type,telecaller FROM temp1 WHERE (date='
_POST [select]'或telecaller ='
_POST[select]' OR telecaller='
_POST [select1] \ r')ORDER BY ID ASC"跨度>;
_POST[select1]\r') ORDER BY id ASC ";
这篇关于SQL查询中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!