我有一个有两列的表,其中一列是一列,一列NULL不会,我想做的是:
SELECT (column1 OR column2) AS value
Run Code Online (Sandbox Code Playgroud)
但我需要检索非null值.我觉得这可能是一个简单的问题,但任何帮助表示赞赏.
$to = 'my@email.ca';
$subject = 'Receipt';
$repEmail = 'rep@sales.ca';
$fileName = 'receipt.pdf';
$fileatt = $pdf->Output($fileName, 'E');
$attachment = chunk_split($fileatt);
$eol = PHP_EOL;
$separator = md5(time());
$headers = 'From: Sender <'.$repEmail.'>'.$eol;
$headers .= 'MIME-Version: 1.0' .$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"";
$message = "--".$separator.$eol;
$message .= "Content-Transfer-Encoding: 7bit".$eol.$eol;
$message .= "This is a MIME encoded message.".$eol;
$message .= "--".$separator.$eol;
$message .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$message .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$message .= "--".$separator.$eol;
$message .= "Content-Type: application/pdf; name=\"".$fileName."\"".$eol;
$message .= "Content-Transfer-Encoding: base64".$eol;
$message …Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个动态RSS源,它将自动从MySQL数据库中提取文章.代码如下
<?php
//Include the post retreival script
require_once '../phpScripts/rss_db_setup.php';
//Set the content type
header('Content-type: text/xml');
//Set up the RSS feed information
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'.
'<rss version="2.0">'.
'<channel>'.
'<title>Company Name</title>'.
'<link>http://www.company.ca</link>'.
'<description></description>'.
'<category></category>';
//Retreive posts from the database
$rssData = new rssData();
echo $rssData->generateFeed($dbcon);
//Close the feed
echo '</channel></rss>';
?>
Run Code Online (Sandbox Code Playgroud)
我想知道这个文件是应该保存为.xml还是.php?我已将以下行添加到我的.htaccess文件中,但并不完全理解它是如何工作的
AddType application/x-httpd-php .xml
Run Code Online (Sandbox Code Playgroud)
这是一个正确的方法吗?或者我应该使用另一个htaccess函数,如modRewrite,还是使用CRON作业每天生成一个新的.xml?