Jump to content

Recommended Posts

$f1 = 300;
$y1 = 200;
$yatk = 75;
$fdef = 125;
$y3 = $y * $y2;
$f3 = $f * $f2;

The code functions 100% fine when the numbers entered into the text box (which is where $y and $f come from) are odd. It will work fine if $y is even (20, 22, 24) and $f is the next number (21, 23, 25).

 

If $y = ODD and $f = EVEN it won't work. And if it's 2 even numbers it won't work.

 

 

So, question is: how do I get it to make...

1. 2 even numbers work

2. Odd ($y) and Even ($f) numbers work

Link to comment
https://forums.phpfreaks.com/topic/157750-solved-math-issue/
Share on other sites

In an error of mine (quickly trying to change the variables into something less...confusing), I seem to have put a 2 where the 1 should be. I know it _should_ work, but something is wrong.

 

New updated code...still same issues...

$f1 = 300;
$y1 = 200;
$yatk = 75;
$fdef = 125;
$y3 = $y * $y1;
$f3 = $f * $f1;

Link to comment
https://forums.phpfreaks.com/topic/157750-solved-math-issue/#findComment-832058
Share on other sites

Maq, I don't think the OP post all of his code. $y and $f as stated came from some input fields. I assume he used the correct $_GET, $_POST, $_REQUEST or filter_input() to get the information.

 

Right, my bad, need to get some sleep...

 

So OP, if there are 1 or more even numbers then it won't work...?  Like everyone else said, you may want to post some more code and elaborate on what, "it won't work" means.

Link to comment
https://forums.phpfreaks.com/topic/157750-solved-math-issue/#findComment-832149
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.