jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
Internal server error is an apache error, and the specific problem will be listed in the server log. If you can't find it, contact the host.
-
The errors 'Internal Server Error' & 'Premature end of script headers', are indeed apache. The specifics should be in the server error log. What is your current time limit set at? I don't see it in your list.
-
Check the server error log, it will give you the exact reason. If that is not possible, for de-bugging purposes only. Place the following at the top of your script. error_reporting(E_ALL); //over ride error reporting in php.ini ini_set("display_errors", 1); //print errors to screen.
-
Of course it will take longer for it to load if the server is offline. The fsocketopen() will have to wait for the timeout to expire.
-
calculating true and false positives and negatives
jcbones replied to bolter's topic in PHP Coding Help
Try along these lines. <?php $redObserved = array(4, 56, 78, 44, 90); $redExpected = array(4, 78, 33, 34); $redPositive = count(array_intersect($redObserved,$redExpected)); echo $redPositive; ?> -
Run a test file with this inside. <?php phpinfo(); ?> Look under CORE and examine these lines. file_uploads = ON/OFF max_execution_time = maximum amount of time the script will run. memory_limit = maximum amount of memory the script can allocate. post_max_size = maximum size for POST. upload_max_filesize = maximum size for a file upload.
-
http://dev.mysql.com/doc/refman/5.0/en/update.html UPDATE table SET col = 'value' WHERE col = 'value';
-
Add this line: echo '<pre>'; print_r($statesearch); echo '</pre>'; Right after these lines: $st = $rowcompany['states']; $statesearch = explode(',', $st); And copy/paste what is printed to the browser window.
-
Ideally all processing should reside outside of HTML output. This way you can manipulate the page the way you would like. You can run this script as a test, to show you what I'm talking about. <?php if(isset($_POST['submit'])) { header('Status: 200'); header('Location: ' . $_SERVER['PHP_SELF'] . '?pass=true'); } elseif(isset($_GET['pass'])) { $message = 'You have successfully posted the form, now hit f5 for refresh.'; } else { $message = 'Please submit the form.'; } ?> <html> <head> <title>Test</title> </head> <body> <?php echo $message; ?> <form action="" method="post"> <input type="text" value="test" name="test"/> <input type="submit" name="submit" value=" SUBMIT " /> </form>
-
How Do You Find The NEXT Year A Day Falls On A Date?
jcbones replied to jjgilels's topic in PHP Coding Help
Try this: $month = '08'; $day = '13'; $year = '1978'; $date = strtotime($year.'-'.$month.'-'.$day); $findDate = date('l',$date); $interval = strtotime('+1 Year',strtotime(date('Y').'-'.$month.'-'.$day)); $current = date('l',$interval); while($current != $findDate) { $interval = strtotime('+1 Year',$interval); $current = date('l',$interval); } echo date('l F d, Y',$interval); -
We need the database structure in order to help you.
-
Get you a good editor with a syntax highlighter, and you would instantly recognize this problem. function waitmsg($dmsg,$whereto) { echo "<script language='javascript'>setTimeout(\"location.href='http://".$site_url."/".$whereto."',5);</script>"; echo "<br><br><br><div align='center'>".$dmsg."</div><br>"; echo "<div align='center'>Please wait while you're automatically redirect, If you are not forwarded within 5 seconds, please click <a href='http://".$site_url."/".$dmsg.">here</a>.</div><br><br><br>"; }
-
How Do You Find The NEXT Year A Day Falls On A Date?
jcbones replied to jjgilels's topic in PHP Coding Help
I did it both ways. So you could use either one. <?php //Object Oriented. echo 'Object Oriented.<br />'; $date = new DateTime('1978-08-13'); $findDate = $date->format('l'); $interval = $date->add(new DateInterval('P1Y')); while($date->format('l') != $findDate) { $date->add(new DateInterval('P1Y')); } echo $date->format('l F d, Y'); //Procedural echo '<br /><br />Procedural<br/>'; $date = strtotime('1978-08-13'); $findDate = date('l',$date); $interval = strtotime('+1 Year',$date); $current = date('l',$interval); while($current != $findDate) { $interval = strtotime('+1 Year',$interval); $current = date('l',$interval); } echo date('l F d, Y',$interval); ?> -
How Do You Find The NEXT Year A Day Falls On A Date?
jcbones replied to jjgilels's topic in PHP Coding Help
http://www.php.net/manual/en/datetime.installation.php -
How Do You Find The NEXT Year A Day Falls On A Date?
jcbones replied to jjgilels's topic in PHP Coding Help
August 13, 1978 was a Sunday. This will get the info, that the next time August 13 happens on Sunday is in 1989. There may be a better way, but this is what I came up with. <?php $date = new DateTime('1978-08-13'); $findDate = $date->format('l'); $interval = $date->add(new DateInterval('P1Y')); while($date->format('l') != $findDate) { $date->add(new DateInterval('P1Y')); } echo $date->format('l F d, Y'); ?> -
Paganation Tutorial
-
This error is generated from the database. Your query is good, only you have one of those columns named a primary, or unique key. This means you cannot put duplicate values in that column. Your script is good. Post your database structure, and we can help.
-
Instead of: $template = "news_template.php"; $new = "news_upload/$year/$month/$day/$title.php"; copy($template,$new); Try: $template = file_get_contents("news_template.php"); $new = "news_upload/$year/$month/$day/$title.php"; file_put_contents($new,$template); I suggest this, because a lot of host disable copy for security reasons.
-
He left out a comma. implode('\',\'', $authArray)
-
Best Tutorial I have found is here
-
Index...Index...Index I would put an index on any column that is being used as a search parameter. You could also run a Cron on the tables at midnight, or at end of shift (when resources are un-used), and generate a file of all the alerts. Displaying them on login, at shift start. You could also make a manual system that runs concurrently with the above, or as a stand alone.
-
Add error checking: $result = mysql_query($sql) or die($sql . ' [has an error]: ' . mysql_error());
-
Add this: // Create the image $img = imagecreatetruecolor(CAPTCHA_WIDTH, CAPTCHA_HEIGHT) or die('Cannot Initialize new GD image stream'); And see if the image is created. You have the right GD version for it.
-
Does your host use a proxy?
-
Or change the string wrappers from double quotes to single quotes.