-
Posts
12 -
Joined
-
Last visited
Never
Posts posted by EngineeringGuy
-
-
I have a table with four columns that are five to ten characters wide. There are approximately fifty rows in the the table (though it needs to dynamically be able to get longer and shorter, depending on results from a mysql query)
I have been having a heck of a time trying to take the results and display the first half on the left and the second half on the right of the page. I am trying to take a long narrow table:
and turn it into this:
Result 11 Result 12 Result 13 Result 14 | Result 31 Result 32 Result 33 Result 34 -
okay
-
Can you have too many includes? Is there a benefit to minimizing the number of includes you utilize in your program?
-
[quote author=fert link=topic=112372.msg456019#msg456019 date=1161560011]
it would be kind of hard to make a forum from scratch, so i'd recomend using a pre-made forum like phpbb and tweaking how ever you want.
[/quote]
Best. Advice. Ever. -
Do you have an if statement? Also, depending on the code above it, you may have too many }
-
I think he means something like this:
http://www.sms-lp.com/inforeq.php
That is something I made for my office. . Basically the script is sending the email and nobody (except for you) ever knows what address it goes to.
(Please don't spam it too much as my secratary might get a little pissed =-D ) -
Thanks a million! I put this in: if ($key){ and it worked like a charm!
-
What is the problem? Also, can you put your code in the [ code ] brackets to save my mousewheel a bit?
-
I am writing a function to convert a table of numbers from decimal e.g. (4.25) to fractional form (4 1/2) Certain columns of the table need to be ignored because they contain a letter or there is no fractional equivalent. The fractional form is to a 1/16 accuracy. (You can see a sample table here: [url=http://www.piping-designer.com/pages/flanges/fl150wnrtj.php]http://www.piping-designer.com/pages/flanges/fl150wnrtj.php[/url])
I wrote the following function. My problem is this, when I search for items that are not listed in the array, it returns just the integer and that is unacceptable for this project. I have tried creating a fraction with 16ths as a denominator and reducing the fraction using the Euclidian algorithm but I reached same problem when the fraction would not reduce. How can I get the function to exit if $key is not found in the array?
Here's the code:
[code]<?php
function fraction($value){ // Define arrray that we are checking against
$values = array('1/16' => .0625, '1/8' => .125, '3/16' => .1875,
'1/4' => 0.25, '5/16' => .3125, '3/8' => .375, '7/16' => .4375,
'1/2' => .5, '9/16' => .5625, '5/8' => .625, '11/16' => .6875,
'3/4' => .75, '13/16' => .8125, '7/8' => .875, '15/16'=>.9375);
if (eregi('[[:alpha:]]', $value)) {
return $value; //contains any letter letter we're done here
}else{ //There are no letters so we continue
$intnum=floor($value); //take the value and round it down
$dec = $value - $intnum; //Get the decimal portion of the original value
$key = array_search($dec, $values,strict); //search the array for the decimal value
if ($intnum < 1){ //if the value is less than zero, then we will return just a fraction
$value = $key;
}else{ //otherwise we will return the integer and the fraction
$value = $intnum." ".$key;
}
return $value;
}
}
?>[/code]
EDIT: Tried to fix formatting but failed horribly -
Thank you for your help!!
-
I am sure there is an easier way to do this but I don't yet know how to do it. Is there a way I can perform the round function to the following:
[code]//First we round the values to get sig figs. We don't round the first value since its the NPS
$sigfig="2"; /number of decimal values
$col2=round($col2,$sigfig);
$col3=round($col3,$sigfig);
$col4=round($col4,$sigfig);
$col5=round($col5,$sigfig);
$col6=round($col6,$sigfig);
$col7=round($col7,$sigfig);
$col8=round($col8,$sigfig);
$col9=round($col9,$sigfig);
$col10=round($col10,$sigfig);
$col11=round($col11,$sigfig);
$col12=round($col12,$sigfig);
$col13=round($col13,$sigfig);
$col14=round($col14,$sigfig);
$col15=round($col15,$sigfig);[/code]
This gets tedious to write over and over. . . maybe I could use a For function?
Subdividing long narrow tables
in PHP Coding Help
Posted
thank you! I'll give this a shot this morning!