Home > Backend Development > PHP Tutorial > 下列语句该怎么设置多条件查询

下列语句该怎么设置多条件查询

WBOY
Release: 2016-06-13 12:08:24
Original
762 people have browsed it

下列语句该如何设置多条件查询
$result_style = $row['result'] == '红色'  ? ' style="color:red"' : '';

这条代码只能在result是红色的时候,sytle才能显示为红色。
如何让result是红色的时候,并且$row['type']==‘小明’时,style显示为红色呢? 
------解决思路----------------------
$result_style = $row['result'] == '红色'  && $row['type']==‘小明’ ? ' style="color:red"' : '';
------解决思路----------------------

<br />$result_style = $row['result'] == '红色' && $row['type']=='小明'  ? ' style="color:red"' : '';<br />
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template