Jump to content

infid3l

Members
  • Posts

    79
  • Joined

  • Last visited

About infid3l

  • Birthday 09/05/1962

Profile Information

  • Gender
    Female

infid3l's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here's a function I wrote that you might find useful: <?php function GetBetween($find1, $find2, $string) { $parse = explode($find1, $string, 2); $parse = substr($parse[1], 0, stripos($parse[1], $find2)); return $parse; } print GetBetween("<b>", "</b>", "<b>DATA</b>"); // prints "DATA" ?>
  2. If you only need to return X amount of results, always add this to the end of your SQL query: LIMIT x For example: SELECT username FROM user_db WHERE name='Ted' LIMIT 5
  3. <?php $contents = file_get_contents("http://www.google.com"); file_put_contents("saved.html", $contents); ?>
  4. I think you can run a SMTP server locally and do: jd2007@236.43.79.32 Or something like that. If you're interested in setting one up, I can help you out via MSN.
  5. Although this forum deals with MySQL integration in PHP, I'll help you out: http://www.richtsoft.com/mysql_52_visual-basic.html Google is your friend.
  6. Unix timestamps? <?php if (($timestamp1 - $timestamp2) >= 172800) { // older than 2 days } ?> Otherwise: <?php if ((strtotime($timestamp1) - strtotime($timestamp2)) >= 172800) { // older than 2 days } ?> $timestamp1 being the larger value, of course.
  7. I have no idea, but I do know that all timezones are compared to GMT (Greenwich Mean Time) which is 0. The offsets are measured in +# and -#. For the Western Hemisphere, you'll need these names: http://terra.gg.utah.edu/timezones.html
  8. <?php print "<SELECT NAME='ZONE'>"; for ($i=-8;$i<=8;$i++) { if($i> 0) { print "<OPTION VALUE='$i'>Timezone: +$i</OPTION>\n"; } else { print "<OPTION VALUE='$i'>Timezone: $i</OPTION>\n"; } } print "</SELECT>"; ?> I don't think PHP gives their names. edit: Oops! fixed my mistake.
  9. Your code gives an error. Parse error: syntax error, unexpected $end in C:\Documents and Settings\My Documents\xampp\htdocs\index.php on line 42 the code I supplied shouldn't give one, I tested it. Oh I see, what was the other error? His IF statements are hard to read.
  10. I just posted that two replies up...
  11. <?php $a= $_POST['a']; $b= $_POST['b']; $c= $_POST['c']; function quadratic ($a, $b, $c, $root) { { $precision = 3; // Change this value for a different decimal places rounding. $bsmfac = $b*$b-4*$a*$c; if ($bsmfac < 0) { // Accounts for complex roots. $plusminusone = " + "; $plusminustwo = " - "; $bsmfac *=-1; $complex=(sqrt($bsmfac)/(2*$a)); if ($a < 0){ //if negative imaginary term, tidies appearance. $plusminustwo = " + "; $plusminusone = " - "; $complex *= -1; } // End if ($a < 0) $lambdaone = round(-$b/(2*$a), $precision).$plusminusone.round($complex, $precision).'i'; $lambdatwo = round(-$b/(2*$a), $precision).$plusminustwo.round($complex, $precision).'i'; } // End if ($bsmfac < 0) else if ($bsmfac == 0) { $lambdaone = round(-$b/(2*$a), $precision); $lambdatwo = round(-$b/(2*$a), $precision); } // End else if (bsmfac == 0) else { $lambdaone = (-$b+sqrt($bsmfac))/(2*$a); $lambdaone = round($lambdaone, $precision); $lambdatwo = (-$b-sqrt($bsmfac))/(2*$a); $lambdatwo = round($lambdatwo, $precision); } if ($root == 'root1') {return $lambdaone;} if ($root == 'root2') {return $lambdatwo;} if ($root == 'both') {return $lambdaone. ' and ' .$lambdatwo;} } // End function ?>
  12. function quadratic ($a, $b, $c, $root) {
  13. You can just do: $html = file_get_contents("http://www.ndbc.noaa.gov/data/realtime2/41004.spec"); or: $html = implode('', file('http://www.ndbc.noaa.gov/data/realtime2/41004.spec')); btw your problem was you had the "http://" in the host, which fsockopen() doesn't like. and, $request = "GET $page HTTP/1.0&#38;#92;r&#38;#92;n"; $request .= "Host: $host&#38;#92;r&#38;#92;n"; $request .= "Referer: $host&#38;#92;r&#38;#92;n"; should have been: $request = "GET $page HTTP/1.1\r\n"; $request .= "Host: $host\r\n"; $request .= "Connection: Close\r\n\r\n";
  14. WHERE forum_id=$id ORDER BY sticky DESC, recent DESC is identical to WHERE forum_id=$id ORDER BY sticky,recent DESC
  15. Try changing: $num = mysql_numrows($pmnum); to $num = mysql_num_rows($pmnum);
×
×
  • 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.