henryblake1979 Posted February 26, 2010 Share Posted February 26, 2010 hello I am looking for some help I am trying to code this from an excel sheet I am a beginner and need a bit of advice =IF($A>=6,($A-5)*$B,0) The bit I am struggling with is setting the value of $A to >= 6 Any help or advice would be amazing. Cheers Henry Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/ Share on other sites More sharing options...
trq Posted February 26, 2010 Share Posted February 26, 2010 I don't understand the problem? Your trying to re-write an excel spreadsheet expression in php? Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018448 Share on other sites More sharing options...
henryblake1979 Posted February 26, 2010 Author Share Posted February 26, 2010 Yes I have a client who has given me an excel spreadsheet which calculates the number of components which go together to make up a single product. This is for a website calculator. The formula is for calculating one of the component quantities. I am trying to basically transfer the excel sreadsheet into a php form. for the site Any help would be great Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018463 Share on other sites More sharing options...
seany123 Posted February 26, 2010 Share Posted February 26, 2010 you are not able to actually set $A to >= 6. you could try if ($A >= 6){ $answer = (($A-5)*$B,0); } but this is me just taking a stab in the dark at what your trying to achieve. Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018465 Share on other sites More sharing options...
henryblake1979 Posted February 26, 2010 Author Share Posted February 26, 2010 Hello I tried to do what you said but it brings up and error page saying unexpected ; Here is my code below <?php if ($_GET['calc'] == "yes") { $length = $_GET['length']; $height = $_GET['height']; $corners = $_GET['corners']; $tjunctions = $_GET['tjunctions']; $openends = $_GET['openends']; $buttresses = $_GET['buttresses']; $blocx5 = ("$tjunctions"+"$openends")*("$height"/"2"); $blocx4 = "$corners"*"$height"; $blocx3 = $_GET['blocx3']; $blocx2 = $_GET['blocx2']; } $blocx10 = "$length"/"0.75"*"$height"-("$blocx5"+"$blocx4")/"2"; $capping = "$length"/"1.5"-"$corners"; $cornercapping = "$corners"; $dowels = ("$blocx10"*"4")+("$blocx5"*"2")+("$blocx4"*"3"); $angle = ("$tjunctions"*"$height")+"$cornercapping"; $spike = "$length"/"2.5"; if ("$height" >= "6") { $bq10 = (("$height"-"5)"*"$buttresses"; } Any Help would be great Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018478 Share on other sites More sharing options...
jl5501 Posted February 26, 2010 Share Posted February 26, 2010 your first problem is you need to remove the quotes on all statements doing calculations on numercal data Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018487 Share on other sites More sharing options...
jl5501 Posted February 26, 2010 Share Posted February 26, 2010 <?php if ($_GET['calc'] == "yes") { $length = $_GET['length']; $height = $_GET['height']; $corners = $_GET['corners']; $tjunctions = $_GET['tjunctions']; $openends = $_GET['openends']; $buttresses = $_GET['buttresses']; $blocx5 = ($tjunctions + $openends ) * ($height / 2); $blocx4 = $corners * $height; $blocx3 = $_GET['blocx3']; $blocx2 = $_GET['blocx2']; } $blocx10 = ($length / 0.75) * $height - ($blocx5 + $blocx4) / 2; $capping = $length/ 1.5 - $corners; $cornercapping = $corners "; $dowels = ($blocx10 * 4) + ($blocx5 * 2) + ($blocx4 * 3); $angle = ($tjunctions * $height) + $cornercapping; $spike = $length / 2.5; if ($height >= 6) { $bq10 = ($height - 5) * $buttresses; } Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018489 Share on other sites More sharing options...
henryblake1979 Posted February 26, 2010 Author Share Posted February 26, 2010 Hello That has cracked it! Thank you very much! Link to comment https://forums.phpfreaks.com/topic/193452-if-greater-than-or-equal-too/#findComment-1018496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.