2011-11-18 77 views
0

這裏是我的代碼:出於某種原因,PHP顯示在我的textarea框

<textarea> 
<? 
while ($row = mysql_fetch_array($result)) { 
    echo $row[0], $row[1] . "\n"; 
    ?> 
</textarea> 

它輸出到textarea的框,並創建第二個框:

<? 
while ($row = mysql_fetch_array($result)) { 
    echo $row[0], $row[1] . "\n"; 
    ?> 

對於長標籤和花括號,我現在得到這個!哈哈:

<br /> 
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'> 
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>(!)</span> Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\globaldetroit\index.php on line <i>23</i></th></tr> 
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> 
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> 
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0006</td><td bgcolor='#eeeeec' align='right'>672248</td><td bgcolor='#eeeeec'>{main}()</td><td title='C:\wamp\www\globaldetroit\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr> 
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0037</td><td bgcolor='#eeeeec' align='right'>679240</td><td bgcolor='#eeeeec'><a href='http://www.php.net/mysql_fetch_array' target='_new'>mysql_fetch_array</a> 
()</td><td title='C:\wamp\www\globaldetroit\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>23</td></tr> 
</table></font> 

當我在我的SQL代碼中刪除我的「排序」語句時,此錯誤消失。

+2

看來你還在拉你在一個textarea的編輯整個數據庫內容的想法。如果我是你的父親... –

+1

任何人都記得整個網站看起來像那樣的錯誤信息? – Herbert

回答

7

試試這個,短標籤可能會在服務器上被禁用:

<?php 
while ($row = mysql_fetch_array($result)) { 
echo $row[0], $row[1] . "\n"; 
?> 

編輯:

你缺少一個右}while循環:

<?php 
while ($row = mysql_fetch_array($result)) 
{ 
    echo $row[0], $row[1] . "\n"; 
} 
?> 
+0

那麼,似乎工作,sorta,現在我有這個: 解析錯誤:語法錯誤,意外的$結束在C:\ wamp \ www \ globaldetroit \ index.php在線34 –

+0

看到我的編輯。 –

+0

噢,來自另一個傑克的嗨傑克。 –

1

要麼short_open_tag的值爲已關閉或PHP未運行

1

嘗試:

<textarea> 
<?php 
while ($row = mysql_fetch_array($result)) { 
    echo $row[0], $row[1] . "\n"; 
} 
?> 
</textarea> 
相關問題