php在存储过程sql server中的特定列中查找指定单词
我对php有点陌生,我正在寻找一种方法,从sql server存储过程中获得的特定列中获取一些单词。这些“单词”将帮助我使用它们作为css的样式 例如: 列HTML_代码有时包含“粗体”、“绿色”或其他内容。有时它们在同一列中,但顺序并不总是相同的。我不知道如何在我的循环中使用它们。看看我现在所拥有的:php在存储过程sql server中的特定列中查找指定单词,php,stored-procedures,Php,Stored Procedures,我对php有点陌生,我正在寻找一种方法,从sql server存储过程中获得的特定列中获取一些单词。这些“单词”将帮助我使用它们作为css的样式 例如: 列HTML_代码有时包含“粗体”、“绿色”或其他内容。有时它们在同一列中,但顺序并不总是相同的。我不知道如何在我的循环中使用它们。看看我现在所拥有的: $result = sqlsrv_query($conn, $sql); while ($row = sqlsrv_fetch_array($result)) { //prin
$result = sqlsrv_query($conn, $sql);
while ($row = sqlsrv_fetch_array($result))
{
//print_r( $row ); // debug code
if ($row['HTML_CODE'] == 'BOLD(), Green()'){
$couleur='green';
$font= 'bold';
}
else {
$couleur='black';
$font= 'normal';
}
?>
<tbody>
<tr>
<?php echo "<tr style=\"font-weight:$font; color:$couleur;\">"; ?>
<td><?php echo ($row['Nom']); ?></td>
<td><?php echo ($row['Quantite']); ?></td>
<td><?php echo ($row['Montant']); if (is_numeric($row['Montant'])) {
echo ' $';
}?></td>
<td><?php echo ($row['#GL']); ?></td>
<td><?php echo ($row['Debit']); if (is_numeric($row['Debit'])) {
echo ' $';
} ?></td>
<td><?php echo ($row['Credit']); if (is_numeric($row['Credit'])) {
echo ' $';
}?></td>
</tr>
</tbody>
$result=sqlsrv\u查询($conn,$sql);
while($row=sqlsrv\u fetch\u数组($result))
{
//打印($row);//调试代码
如果($row['HTML_CODE']=='BOLD(),Green()')){
$couleur='green';
$font='bold';
}
否则{
$couleur='black';
$font='normal';
}
?>
if(strstrstr($row['HTML_-code'],“BOLD()”){$font='BOLD';}那么,您是否设法让它工作起来了?是的,使用strstrstr如下:if(strstrstr($row['HTML_-code'],“BOLD()”){$font='BOLD';}