2015-03-30 41 views
-1

是否可以在回声声明中回显?满足条件时在回声声明中回显

我有一个if语句,回声一个HTML元素,如果时间条件满足。我想echo echo $ rows ['SOMETHING'];在这个回声中。所以...

if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from']) 
      { 
      echo'<div class="opening_times_times_orange"> ***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>'; 
      } 

      else echo '<div class="opening_times_times_red">***** echo $rows['opening_monday_from'] . " " . "-" . " " $rows['opening_monday_to'] ***** </div>'; 
     ?> 

我想回应什么之间的*****,但它不会允许我与当前的脚本。

如何解决这个

if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from']) 
{ 
echo'<div class="opening_times_times_orange"> HERE </div>'; 
} 
else echo '<div class="opening_times_times_red"> HERE </div>'; 

HERE(1)echo $rows['opening_monday_from'];echo $rows['opening_monday_to']; HERE(2)echo $rows['opening_monday_from'];echo $rows['opening_monday_to'];

+0

只是做回声”

'.$rows['opening_monday_from'] . " " . "-" . " ".$rows['opening_monday_to'].'
“; ? – 2015-03-30 19:18:21

+0

= $行[ 'opening_monday_from']){ \t \t回声 '

***** ' \t \t \t . $rows['opening_monday_from'] - $rows['opening_monday_to'] \t \t \t . ' *****
'; } else { \t echo \t'
***** ' \t \t \t . $rows['opening_monday_from'] - $rows['opening_monday_to'] \t \t \t . ' *****
'; } ?> – 2015-03-30 19:23:33

+0

无法让它工作edidted在哪里我想添加$行['opening_monday_from'] – 2015-03-30 19:27:32

回答

0

试试这个: -

if ($whatdayisit === Monday && $gmt <= $rows['opening_monday_to'] && $gmt >= $rows['opening_monday_from']) 
      { 
      echo'<div class="opening_times_times_orange"> *****'. $rows['opening_monday_from']. " " . "-" . " ".$rows['opening_monday_to'].' ***** </div>'; 
      } 

      else echo '<div class="opening_times_times_red">*****'.$rows['opening_monday_from'] . " " . "-" . " " .$rows['opening_monday_to'].' ***** </div>'; 
     ?> 
+0

无法使用,我在问题 – 2015-03-30 19:32:06

+0

中提出了另一个意见,即值来自于某个地方或不是?如果是的话,它会起作用。我刚刚编辑了我的代码检查。 – 2015-03-30 19:36:18

+0

是的,他们来自一个分区 这工作; echo'

'.$rows["opening_monday_from"].'
'; 如何添加其他$行['opening_monday_to']到这个? – 2015-03-30 19:44:24