Jump to content

djnrempel

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

djnrempel's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=361645:date=Apr 4 2006, 01:25 PM:name=jesirose)--][div class=\'quotetop\']QUOTE(jesirose @ Apr 4 2006, 01:25 PM) [snapback]361645[/snapback][/div][div class=\'quotemain\'][!--quotec--] Actually the way redbullmarky posted worked perfectly. Here's what I get now when B = 7 0/7: 15 1/7: 17 2/7: 20 3/7: 23 4/7: 26 5/7: 29 6/7: 32 7/7: 35 [/quote] But it would not work if you wanted 1/10 to be 15%, it would have made 1/10 equal to 17% (15 + (1/10 *20)) But I see now that you wanted 0 to be 15% - did you edit that or was it just Mark who started all this 1/10 = 15% nonsense ;)
  2. The way I have incremented dates is to get the unix timestamp of the first date, then increment it by the number of seconds in one day, and then use the date function to convert it back to Y-m-d or whatever.
  3. Then you'll need a script that opens each file, and then checks whether and where that file contains the search terms. Read through the PHP documentation on file / directory functions. To actually find and report stuff, you'll need to use something like strstr or the more powerful ereg or preg_match. Best just to read up on those functions and hack away at it. It would be a lot easier and faster (computer-wise) if the bible was in a database such as MySQL. Just noticed that JohnHurt.com has some search tool - maybe he'll share it with you too.
  4. I think you have some unstated constants in your problem, namely a $floor of 1 and a $ceiling of 10 (although $b seems to contain that constant) Your problem is to convert a value between $floor and $ceiling to a value between 15 and 35. Basically, this is the same as converting celsius to fahrenheit - the units are of different size, and the scale starts at different points. [code]// First, find the scales, and the ratio between them: $scale1= $ceiling-$floor; // will evaluate to 9 if $floor is 1, 10 if $floor is 0 $scale2= 35-15; // equals 20 $factor= $scale2 / $scale1; // if $scale is 9 this will be some ugly decimal, if it is 10 it will be a nice tidy 2 // now convert $a to value on $scale2: $percentage = ($a - $floor) * $factor; // if $floor is 1 then if $a==1 $percentage will be 0 $percentage  += 15; // add the base of 15 to the percentage value[/code] if you really have to have a floor of 1, I suggest using round() on your result.
  5. An approach that I have used is to create a separate array containing the names of the array keys you want to process. eg: [code]$types=array ('M2_Abrams','M1_Whatever', ...);[/code] then [code]foreach ($types as $val) { dosomething ($_POST[$val]); }[/code] What I like about this approach is that I can add other fields of different types to the form later without worrying about having to filter them out. Also, you can use that same array to dynamically create those form fields instead of having to type them all in to echo statements. To add a new form to your field, you just add a new value to the $types array, which just has to be available to all the functions that would use it then.
  6. [!--quoteo(post=361608:date=Apr 4 2006, 12:10 PM:name=chrisa)--][div class=\'quotetop\']QUOTE(chrisa @ Apr 4 2006, 12:10 PM) [snapback]361608[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello all! New to php and the groups here at phpfreaks. I have a web site that has a html Bible on it. I would like to know how to create a search form that will search all the books of that online Bible. For instance, you goto the website and type in "romans" and then click on "search". It then should return all referneces of the word "romans". I did look through the "scripts" section here but found dead links. Also did a "search" throught the forums but did not see what i needed. Let me know if anyone needs the site link. Thanks for any help. Chris [/quote] How you search your bible greatly depends on how that bible is stored - is it in a database? Multiple html pages? Where did you get this bible and could you post a link?
  7. [!--quoteo(post=361609:date=Apr 4 2006, 12:16 PM:name=Sebastiangperez)--][div class=\'quotetop\']QUOTE(Sebastiangperez @ Apr 4 2006, 12:16 PM) [snapback]361609[/snapback][/div][div class=\'quotemain\'][!--quotec--] dear PHPhreaks How i can create a dynamic calendar , that i can put dates on a database, and then show into the calendar whit another colors , like a booking hotel system , i want to make by my self .. i need a little help .. best regards. Sebastian msm:sebastiangperez@hotmail.com [/quote] Umm, that's a pretty broad request. I suggest you start working on one (or search through script archives) and then post here as you need help solving individual problems. That's how I learned PHP, function by function as I tackled different problems. In broad terms, you will need to design what it should look like, create a script that will generate that, and then build the parts that will read data from users, add it to the database, and then display search results. I have a script that displays a calendar of the last 31 days, if that helps - see it in action at [a href=\"http://frood.net/comics/\" target=\"_blank\"]http://frood.net/comics/[/a] [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$blankdays= strval(date("w", tt('30'))); $emptycells=""; $x=0; while ($x<$blankdays): $x++; $emptycells .= '<td> </td>'; endwhile; echo ' <table border="1" cellpadding ="3"> <tr><th>Sun.</th><th>Mon.</th><th>Tue.</th><th>Wed.</th><th>Thu.</th><th>Fri.</th><th>Sat</th></tr> <tr>'.$emptycells; $x=31; while ($x>0): $x--; $month=date("M", tt($x)); $weekday=date("D", tt($x)); $numdate=date("j", tt($x)); $break=''; if ($weekday=="Sat") $break="</tr>\n<tr>"; $style='""'; if ($weekday=="Sun") $style='"font-weight:bold;"'; echo "date("n/j", tt($x))."</td>$break "; endwhile; $blankdays= 7-(strval(date("w", tt(0)))); $emptycells=""; $x=1; while ($x<$blankdays): $x++; $emptycells .= '<td> </td>'; endwhile; echo $emptycells.'</tr></table>';[/quote]
  8. the function you want is substr (for substring). Here is how you would use it to find the last 2 characters of a string: $string="abcdef"; $rest = substr($string, -2); // returns "ef" the "-2" means it will take a substring starting from 2 characters before the end, and since no end parameter is given, it takes the whole rest of the string. For more on this function, check [a href=\"http://ca.php.net/substr\" target=\"_blank\"]http://ca.php.net/substr[/a]
  9. I would guess that the new script is sending variables via GET instead of POST. Try altering the other variables the same way, eg. removing the $_POST['variable'] and just expressing them as $variable. Alternately, try substituting the $_POST with either $_GET, or $_REQUEST (which will catch both GET and POST data). The first option should work, since the fact that $email works the same as $_POST['email'] suggests that register_globals is enabled.
×
×
  • 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.