<?
$oby=' $s_t<>"" ';
if ($st<>'')
{
$oby.=' and $s_t>='."'".$st."'";
}
else
{
$oby=$oby;
}if ($st1<>'')
{
$oby.=' and $s_t<='."'".$st1."'";
}
else
{
$oby=$oby;
}
if ($zt<>'')
{
$oby.=' and $r_t>='."'".$zt."'";
}
else
{
$oby=$oby;
}
if ($zt1<>'')
{
$oby.=' and $r_t<='."'".$zt1."'";
}
else
{
$oby=$oby;
}
?><? if ( $oby )
{ ?><?}?>
我想IF条件用变量来赋值可以吗??要怎么实现?
$oby=' $s_t<>"" ';
if ($st<>'')
{
$oby.=' and $s_t>='."'".$st."'";
}
else
{
$oby=$oby;
}if ($st1<>'')
{
$oby.=' and $s_t<='."'".$st1."'";
}
else
{
$oby=$oby;
}
if ($zt<>'')
{
$oby.=' and $r_t>='."'".$zt."'";
}
else
{
$oby=$oby;
}
if ($zt1<>'')
{
$oby.=' and $r_t<='."'".$zt1."'";
}
else
{
$oby=$oby;
}
?><? if ( $oby )
{ ?><?}?>
我想IF条件用变量来赋值可以吗??要怎么实现?
你是要这种东西吗?
并没有判断那里面的条件
if( (($st <> '') ? $s_t >= $st : true) && (($st1 <> '') ? $s_t <= $st1 : true)
&& (($zt <> '') ? $r_t >= $zt : true) && (($zt1 <> '') ? $r_t <= $zt1 : true))
这个是用来干嘛的?
if( $s_t <> '' && (($st <> '') ? $s_t >= $st : true) && (($st1 <> '') ? $s_t <= $st1 : true)
&& (($zt <> '') ? $r_t >= $zt : true) && (($zt1 <> '') ? $r_t <= $zt1 : true))
$oby.=' and $s_t<='."'".$st1."'";
$oby.=' and $s_t<='."'".$st1."'";
等等
应该写成:
$oby.=' and $s_t<=$st1';
或$oby.=' and '.$s_t.'<='.$st1;
PHP里似乎是:!=