1
沒有人知道我會如何填充數據從MySQL數據庫fb:隨機並遍歷它,選擇一個隨機報價?迭代通過fb:隨機
FB:隨機
$facebook->api_client->fbml_setRefHandle('quotes',
'<fb:random>
<fb:random-option>Quote 1</fb:random-option>
<fb:random-option>Quote 2</fb:random-option>
</fb:random>');
MySQL數據:
$rowcount = mysql_result($result, 0, 0);
$rand = rand(0,$rowcount-1);
$result = mysql_query("SELECT cQuotes, vAuthor, cArabic, vReference FROM thquotes LIMIT $rand, 1", $conn)
or die ('Error: '.mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
if (!$row) {
echo "Empty";
}
else{
$fb_box = "<p>" . h($row['cArabic']) . "</p>";
$fb_box .= "<p>" . h($row['cQuotes']) . "</p>";
$fb_box .= "<p>" . h($row['vAuthor']) . "</p>";
$fb_box .= "<p>" . h($row['vReference']) . "</p>";
}
我已經這樣做。但我想知道我將如何使用fb:random標籤來做到這一點? – input 2010-04-20 09:54:10