0

its a simple piece of code but i seem to be having problems
this is the code below

  1. $comp_tot="76";
  2. if ($credits = $comp_tot)
  3. //$sub=$credits_3;
  4. $tot="76";
  5. $ans_1= $tot-$credits;
  6. echo"<p>$ans_1</p>";
  7. echo "there";

this code is working however i dont want the condition to be an equal sign
i want when credits is less that 76 for the code to give me back a number which is the difference between the 76 and the value which is stored in credits. like i said it works as it stands now but i want the condition to be a less than equality. can anyone enlightened me on how to do this please
thanks

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

um...... Use the less-than relational operator '<'. It doesn't take a geek to figure that one out... :P

Edited by Fbody: n/a

0

i was doing that all the time and i was getting an error that y i asked so i can know where i am going wrong

0

Then it is advisable to post the revised code along with the error you receive. Without those, no one besides you has any clue. We're not mind-readers...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.