如何使用php mysql使用wysiwyg显示来自db的数据?

时间:2015-09-22 11:39:23

标签: php mysql

如何使用php mysql使用wysiwyg显示来自db的数据?

首先,这是我的dababase中的数据

declare @ISUSERROLE int = 1
declare @select_1 varchar(2000)
declare @select_2 varchar(2000)
declare @main_sql varchar(4000)
declare @final_set varchar(8000)

set @select_1 = 'PONumber = [RAH_PONumber],
                 RAType = rt.[RAT_Type],
                 ChargeableAmount = [RAH_ChargeableAmount]'

set @select_2 = 'PONumber= [RAH_PONumber],
                 RANumber= [RAH_RANumber],
                 RAType  = rt.[RAT_Type],
                 RAStatus= rs.RAS_Status,
                 RAUploadedBy= [RAH_UploadedByUserName],
                 UploadedOn= [RAH_UploadedOn],
                 ChargeableAmount = [RAH_ChargeableAmount]'

set @main_sql = ' FROM [T_RA_Header] rh
                INNER JOIN dbo.T_RA_Type rt
                 ON rt.RAT_ID = rh.[RAH_RAT_ID]
                INNER JOIN dbo.T_RA_Status rs
                 ON rs.RAS_ID = rh.[RAH_RAS_ID]
                WHERE
                 rh.RAH_RAI_ID = '+convert(varchar,@RAI_ID)+''


set @final_set = 'select '+case  when @ISUSERROLE  = 1 then @select_1 else @select_2 end+@main_sql
--print @final_set
exec (@final_set)

然后,我使用php

 __________________________________________________________
|__id__|______________________message______________________|
|  1   |   aaaaaaa                                         |
|      |      aaaaaaa                                      |
|      |         aaaaaaa                                   |
|______|___________________________________________________|

来自mysql的show data,然后我得到了这个。

<?PHP
include("connect.php");
$sql = "SELECT * FROM message WHERE id = '1'";
$result = mysql_query($sql);
$datas=mysql_fetch_array($result);{
$message = stripslashes(str_replace('\r\n', '<br>',($datas['message'])));
}
echo nl2br($message);
?>

我想得到这个

aaaaaaa
aaaaaaa
aaaaaaa

我该怎么做?

0 个答案:

没有答案