Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.
Moderator: General Moderators
Daniyal
Forum Newbie
Posts: 14 Joined: Tue Jul 19, 2016 4:08 am
Post
by Daniyal » Wed Jul 20, 2016 12:37 pm
Code: Select all
<html>
<head>
<title> conditions </title>
</head>
<body>
<?php
$items = 10;
if($items > 5) {
echo "You get a 10% discount!";
}
else {
echo "You get a 5% discount!";
}
?>
</body>
</html>
Tell me the error in this code ??????? plz tell me
this msg is shown (Oops, try again. It looks like you didn't print anything! ) why ?????
Celauran
Moderator
Posts: 6427 Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada
Post
by Celauran » Wed Jul 20, 2016 12:51 pm
There's nothing wrong with that code. What is this error message and where is it coming from?
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Wed Jul 20, 2016 1:30 pm
Are you doing the Codeacademy thing? Did you see the part about making the code output the 5% discount?
Daniyal
Forum Newbie
Posts: 14 Joined: Tue Jul 19, 2016 4:08 am
Post
by Daniyal » Thu Jul 28, 2016 5:14 am
yes
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Thu Jul 28, 2016 11:59 am
Daniyal wrote: yes
requinix asked two questions. Is that an answer to the first question or both?
(#10850)
Daniyal
Forum Newbie
Posts: 14 Joined: Tue Jul 19, 2016 4:08 am
Post
by Daniyal » Thu Jul 28, 2016 1:37 pm
first i am doing the codeacademy course
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Thu Jul 28, 2016 2:36 pm
So you did not see the part about making the code output the 5% discount? 10 is greater than 5 so your code will output the 10% discount. And the error message mean not you didn't output anything but that you didn't output the correct response.
Take a look at the original code they presented. $items did not have a value of 10. The previous course did have you change the value, but that was a different thing.
Daniyal
Forum Newbie
Posts: 14 Joined: Tue Jul 19, 2016 4:08 am
Post
by Daniyal » Thu Jul 28, 2016 2:47 pm
ok i have done it
thnx
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Thu Jul 28, 2016 3:01 pm
If you tell you the answer then you won't be learning, will you?
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Thu Jul 28, 2016 6:44 pm
For 01 they show you the answer in the example. You should be able to do 02. Show us your idea for 03.
(#10850)