我有一個聲明是從數據庫中獲取信息,然後在完全準備好後打印出來。由於某些原因,我的腳本沒有打印出信息。我有它在這個if語句:準備PHP語句不打印
if($community == ''){ print $community . "\n\n" . "END" . "\n"; } else { print $community; echo "hi";}
這將打印出來的時候是跑:
()中寫道:
但是,這是所有它打印出來。這是來自第8個$社區。=行。所以,我的問題是,爲什麼只打印()寫:並不是所有的變量呢?
// and ticker_symbol ='".$sym."'
$c_sql = "SELECT message_id, subject, author, FROM_UNIXTIME(datestamp,'%m-%d-%Y') AS formatted_datestamp, forum_id, body, thread, user_id FROM phorum_messages WHERE user_id=13423720 ORDER BY datestamp DESC LIMIT 5";
$c_result = mysql_query($c_sql,$connection) or die("Couldn't execute get query");
// Declare Variables
$body = $c_result['body'];
$forum_id = $c_result['forum_id'];
$user_id = $c_result['user_id'];
$author = $c_result['author'];
$formatted_datestamp = $c_result['formatted_datestamp'];
// Prepare the statement
if ($c_result != "") {
$community .= $forumPost = '<<<ENDL '. "\n";
$community .= $body . "\n";
$community .= 'ENDL;' . "\n";
$community .= '$forumPost = stripBBCode(strip_tags($forumPost));' . "\n";
$community .= "\n";
$community .= '<div class="comment">' . "\n";
$community .= '<table cellspacing="0" cellpadding="0" border="0" class="reply"><tbody><tr>' . "\n";
$community .= '<td width="90%"><b><a href="/emerging/forum/read.php?'.$forum_id.','.$user_id.'">'.$author.'</a> ('.$formatted_datestamp.') wrote:</b><br />' . "\n";
$community .= '<p>'.iconv("ISO-8859-1//TRANSLIT", "UTF-8", $forumPost).'</p></td>' . "\n";
$community .= '</tr></tbody></table>'. "\n";
$community .= '</div>' . "\n";
}
// Print out the prepared statement
if($community = ''){ print $community . "\n\n" . "END" . "\n"; } else { print $community;}
@Diodeus WTF你在說什麼?快速刪除...我感覺錯誤閱讀;) – Ryan
你想在$社區做什麼?它看起來像你正在構建的PHP代碼,如果你只是打印它將不會運行? – meiamsome
我建立是抓住它從數據庫@meiamsome – dante466