Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

PHP code Spot the error

Please take a look at the attached code. There is no error reported when I hit the URL, but no output shows up too. Even the ECHO or PRINT statement don't output anything.

Can you please help me find out what the issue is?
<?php

	// Setup
	$testing = true; // in development
	require_once(dirname(__FILE__).'/../config.inc');
	$db = new OCIDatabase();
	// Start/End dates
	if($testing)
	{
		$yesterday = mktime(0, 0, 0, 12, 27,   2010); // determin what yesterday was
		$now = time();
		//$now = mktime(0, 0, 0, 12, 28,   2010); // determin what yesterday was
	}
	else
	{
		$yesterday = mktime(0, 0, 0, date('m'), date('d')-1,   date('Y')); // determin what yesterday was
		$now = time();
	}

// 1. send QES log[report] emails to IT address(es)
	// - select ClientId,TableName,Count from admin_log_qes order by TableName,clientid
	$reports_sql = "Select log.ClientId,log.TableName,log.Count 
					From 
						admin_log_qes log 
					Where 
						log.logstamp >= TO_TIMESTAMP('".date('d', $yesterday).".".date('m', $yesterday).".".date('Y', $yesterday).":18:00:00','DD.MM.YYYY:HH24:MI:SS') 
						AND 
						log.logstamp < TO_TIMESTAMP('".date('d', $now).".".date('m', $now).".".date('Y', $now).":".date('H', $now).":".date('i', $now).":00','DD.MM.YYYY:HH24:MI:SS')";

	Print "Test";

	if($db->select($reports_sql))
	{
		$message = "Report logs from " . date("m/d/Y H:i", strtotime("-24 hours")) . " to " . date("m/d/Y H:i") . ":\n\n";
		while($log = $db->fetch_assoc())
		{
			$message .= " --" . $log['TABLENAME'] . "\n";
		}
		if($testing)
		{
			echo $message . "\n\n";
			//Util::sendEMail(EMAIL_IT, "no-reply@" . $_SERVER['HTTP_HOST'], 'Report Logs', $message);
		}
		else
		{
			Util::sendEMail(EMAIL_IT, "no-reply@" . $_SERVER['HTTP_HOST'], 'Report Logs', $message);
		}
	}

?>

Open in new window

0
codemonkey2480
Asked:
codemonkey2480
  • 2
  • 2
  • 2
1 Solution
 
darren-w-Commented:
Its defiantly on line 30 onwards, assuming  that the  OCIDatabase(); object is created correctly?

Darren
0
 
codemonkey2480Author Commented:
How do I find out? I have not worked with PHP much.
0
 
darren-w-Commented:
add between lines 6/7

if (!is_object($db)) {
        die("no object");
    }

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Beverley PortlockCommented:
Add these lines

ini_set('display_errors',1);
error_reporting( E_ALL );

at the very start of your script after the first <?php tag and see what errors show up
0
 
Beverley PortlockCommented:
Also, if you have access, check your server's error logs
0
 
codemonkey2480Author Commented:
added these 2 lines
ini_set('display_errors',1);
error_reporting( E_ALL );

and found out there was an issue referencing a config file.

Fixed the issue.

thanks all.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now