本文整理汇总了PHP中MySql::FetchAssoc方法的典型用法代码示例。如果您正苦于以下问题:PHP MySql::FetchAssoc方法的具体用法?PHP MySql::FetchAssoc怎么用?PHP MySql::FetchAssoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql
的用法示例。
在下文中一共展示了MySql::FetchAssoc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportContacts
public function exportContacts()
{
require_once dirname(__FILE__) . "/mysql.php";
$pDB = new MySql();
$pDB->Query("SELECT `phonebook`.`Name`, `phonebook`.`Phone` FROM `phonebook` ORDER BY `phonebook`.`Name` ASC");
header("Content-Disposition: attachment; filename=\"smsys_" . date("Y-m-d_His") . ".vcf");
header("Content-Type: application/force-download");
while ($arContact = $pDB->FetchAssoc()) {
echo "BEGIN:VCARD\nVERSION:2.1\nN:;" . $arContact['Name'] . ";;;\nFN:" . $arContact['Name'] . "\nTEL;CELL;PREF:" . $arContact['Phone'] . "\nEND:VCARD\n";
}
$pDB->Log("Export contacts list");
}
示例2: exportSMS
public function exportSMS()
{
require_once dirname(__FILE__) . "/mysql.php";
$pDB = new MySql();
header("Content-Disposition: attachment; filename=\"smsys_" . date("Y-m-d_His") . ".xml");
header("Content-Type: application/force-download");
echo "<?xml version='1.0' encoding='UTF-8'?>\n<channel>\n\t<title>Export :: SMSYS</title>\n\t<pubDate>" . date("D, j M Y G:i:s T") . "</pubDate>\n";
echo "\t<inbox>\n";
$pDB->Query("SELECT * FROM sms_inbox ORDER BY `Date` DESC");
while ($arSMS = $pDB->FetchAssoc()) {
echo "\t\t<item>\n\t\t\t<datetime>" . date("Y-m-d H:i:s", strtotime($arSMS['Date'])) . "</datetime>\n\t\t\t<number>" . $arSMS['Sender'] . "</number>\n\t\t\t<content>" . $arSMS['Content'] . "</content>\n\t\t</item>\n";
}
echo "\t</inbox>\n";
echo "\t<outbox>\n";
$pDB->Query("SELECT * FROM sms_outbox ORDER BY `Date` DESC");
while ($arSMS = $pDB->FetchAssoc()) {
echo "\t\t<item>\n\t\t\t<datetime>" . date("Y-m-d H:i:s", strtotime($arSMS['Date'])) . "</datetime>\n\t\t\t<number>" . $arSMS['Recipient'] . "</number>\n\t\t\t<content>" . $arSMS['Content'] . "</content>\n\t\t</item>\n";
}
echo "\t</outbox>\n";
echo "</channel>";
$pDB->Log("Export inbox SMSs");
}