Jump to content


Photo

Playing time


  • Please log in to reply
4 replies to this topic

#1 piney

piney
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 July 2006 - 07:58 AM

I have set $s8 - $s12 as names

<?php
$loop = 8;
$time = date('H') - 12;

while ($loop <= 12) {
if ($s['$loop'] == Lavish) && ($time == $loop) {
  echo "Lavish is playing now!";
}
elseif ($s['$loop'] == Lavish) && ($time > $loop) {
  echo "Lavish is played at $loop";
}
elseif ($s['$loop'] == Lavish) && ($time < $loop) {
  echo "Lavish is playing at $loop";
}
else echo 'Lavish is not playing this week';
  $loop++;
}?>

I get error "unexpected T_BOOLEAN_AND"
any ideas??

#2 Joe Haley

Joe Haley
  • Members
  • PipPipPip
  • Advanced Member
  • 103 posts
  • LocationCanada, eh?

Posted 16 July 2006 - 08:15 AM

if ($s['$loop'] == Lavish) && ($time == $loop)

Should be

if (($s['$loop'] == Lavish) && ($time == $loop) )

Missed a set of brackets on all conditions.
Give a man a fish; you have fed him for today.  Teach a man to fish; and you have fed him for a lifetime
Don't teach men to program. Teach them to fish.

Please, try the RTFM solution before asking for help:
http://php.net/manual/en/index.php

#3 piney

piney
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 16 July 2006 - 11:28 AM

That worked but my code dont work... if $loop = 10
$s['$loop'] should = $s10 right???

or how would i get that to work???

#4 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 16 July 2006 - 11:39 AM

if $loop =10 then
${'s'.$loop}
is $s10

#5 piney

piney
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 17 July 2006 - 11:13 AM

Thank you ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users