Jump to content


Photo

Quick Question


  • Please log in to reply
5 replies to this topic

#1 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 30 August 2006 - 09:48 AM

Here is the code for my test page:

<?php
$week = "3";
echo 'There are currently 10-$week weeks left before it is built.';
?>

But it displays this There is currently 10-$week weeks left before it is built

Im a newbie and ive been p;layiong around with it but what i want to do it get it to work out 10 minus 3 ($week). What code do i need to do that?

#2 joking

joking
  • Members
  • PipPip
  • Member
  • 29 posts
  • LocationLebanon

Posted 30 August 2006 - 09:55 AM

Hi,
<?php
$week = "3";
$val = 10 - $week;
echo 'There are currently: ".$val." weeks left before it is built.';
?>

Just JoKinG

#3 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 30 August 2006 - 09:58 AM

Thanks.

#4 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 30 August 2006 - 10:06 AM

For some reason with this code:

<?php
$week = "3";
$val = 10 - $week;
echo 'There are currently ".$val." weeks left before it is built.';
?>

It only says this:

There are currently ".$val." weeks left before it is built.

#5 joking

joking
  • Members
  • PipPip
  • Member
  • 29 posts
  • LocationLebanon

Posted 30 August 2006 - 10:11 AM

I m sorry i didnt pay attention to your ' .

you should use ' instead of "

<?php
$week = "3";
$val = 10 - $week;
echo 'There are currently '.$val.' weeks left before it is built.';
?>

Just JoKinG

#6 superhoops

superhoops
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 30 August 2006 - 11:59 AM

Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users