Solved

Why dosent my php file run echo ?

Posted on 2013-11-25
25
407 Views
Last Modified: 2013-12-06
Hi!

Have this beginning of my PHP - file

<?php // RAY_EE_login.php
error_reporting(E_ALL);

echo "TESTING";
die();

require_once('RAY_EE_config.php');
require_once('Connect_databse.php');


// ACCESS TO THIS side IS TESTED BUT NOT CONTROLLED
if ($uid = access_control(TRUE))
{
	$uuktmp = $_COOKIE["uuk"];
	$table1 = 'SHOW_UserOrganisationControlLocation';
	$table2 = 'UserTable';
        --
        --
        --

Open in new window



But when i run PHP-file, it dosent run this:
echo "TESTING";
die();

What is wrong ??
0
Comment
Question by:team2005
  • 9
  • 8
  • 4
  • +3
25 Comments
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 39674267
Nothing wrong with the file.

Do you get any errors?
Do you get any output?
Is your server setup to run PHP?

For testing purposes, dump all the includes and try again.

<?php
echo "TESTING";
die();
echo "Should never get here!";

Open in new window

0
 
LVL 2

Author Comment

by:team2005
ID: 39674340
Hi!

No, dosent get any errors.

Tryed this small coed now, ant this works

<?php // RAY_EE_login.php
echo "TEST";
die();

require_once('Connect_databse.php');
require_once('RAY_EE_config.php');

?>
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39674346
Is your Webserver running ? and Can you check the default file?

<?php
echo phpinfo();
?>
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 39674352
If that small piece of code works, then start adding to it until it breaks - you'll then have a place to look for broken code :)

@logudotcom - the fact that his code runs, I'm guessing so :)
0
 
LVL 2

Author Comment

by:team2005
ID: 39674366
Hi!

WHY dosent this echo run ?

<?php // RAY_EE_login.php
error_reporting(E_ALL);

echo "TESTING";
die();

require_once('RAY_EE_config.php');
require_once('Connect_databse.php');


// ACCESS TO THIS side IS TESTED BUT NOT CONTROLLED
if ($uid = access_control(TRUE))
{
      $uuktmp = $_COOKIE["uuk"];
      $table1 = 'SHOW_UserOrganisationControlLocation';
      $table2 = 'UserTable';
        --old
        --
        --



Its imossible to me to debug the hole file,e echo when it dosent print out the
echo on line 3 ????
0
 
LVL 2

Author Comment

by:team2005
ID: 39674374
Hi!

This code is running fine:

<?php
echo phpinfo();
?> 

Open in new window


Gives me
PHP Version 5.4.9
...
...
...
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 39674403
WHY dosent this echo run ?
In the code you've shown, there's no reason for it to not run, but then you're only showing us part of the code.

If I close off the if() block, your code runs fine on my server. Maybe there's something in the code that you're not showing us that's causing you a problem. Might be worth showing us all of your page.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39674464
Who is your hosting company?  

What are the values in phpinfo() for display_errors, error_log, log_errors?

It's possible that your PHP configuration is suppressing the display of errors, and that you have a parse error somewhere in the "invisible" parts of the scripts.  GoDaddy sometimes does this, probably just to mess with you.

Give us those answers and try adding this line to the top of the script.  We'll get you going somehow!
ini_set('display_errors', TRUE);

Open in new window

0
 
LVL 2

Author Comment

by:team2005
ID: 39674486
Hi!

Here is the code:

<?php
error_reporting(E_ALL);

echo "TESTING";
die();


require_once('RAY_EE_config.php');
require_once('Connect_databse.php');



// ACCESS TO THIS side IS TESTED BUT NOT CONTROLLED
if ($uid = access_control(TRUE))
{
	$uuktmp = $_COOKIE["uuk"];
	$table1 = 'SHOW_UserOrganisationControlLocation';
	$table2 = 'UserTable';
	$table3 = 'Reportform';
	$table4 = 'P_SHOW_Transactions';
	$rec_limit = 10;
	$vilkenrapport=1;
	$rec_count=0;
	$antsider=0;
	$side=0;
	$naviger="";
	$svarsp="Alle";
	$datotil=date('Y-m-d');
	$datofra = date('Y-m-d', strtotime('-3 month'));
	$antrader="10 rader pr side";
	$viserapport=0;
  $brukerID=1;
  $kundeid=1;
// Hent UserID    
   $tsql_callSP = "{call GET_UserID_Cookie( ?, ?)}";
   $params = array( 
                 array($uuktmp, SQLSRV_PARAM_IN),
                 array($brukerID, SQLSRV_PARAM_INOUT)
               );

/* Execute the query. */
   $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
   if( $stmt3 === false )
   {
       echo "Error in executing statement 3.\n";
       die( print_r( sqlsrv_errors(), true));
   }
   else
   {sqlsrv_free_stmt( $stmt3);}
   

   // Hent Organisation    
   $tsql_callSP = "{call GET_OrganisationID_Cookie( ?, ?)}";
   $params = array( 
                 array($uuktmp, SQLSRV_PARAM_IN),
                 array($kundeid, SQLSRV_PARAM_INOUT)
               );
    
    

/* Execute the query. */
   $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
   if( $stmt3 === false )
   {
       echo "Error in executing statement 3.\n";
       die( print_r( sqlsrv_errors(), true));
   }
   else
   {sqlsrv_free_stmt( $stmt3);}   


   if (isset($_POST['submit']))  {
    
      $datofra = $_POST["Datofra"];
  	  $datotil = $_POST["Datotil"];
	    $svarsp = $_POST["svar"];
	    $kontr = $_POST["kontroller"];
	    $brukere = $_POST["brukere"];
	    $vilkenrapport = $_POST["Rapport"];
	    $antrader = $_POST["antrader"];
	    $viserapport=1;	 
      $side=0;	  
	  
	    if ($antrader=="10 rader pr side"){$rec_limit=10;}
	    if ($antrader=="15 rader pr side"){$rec_limit=15;}
	    if ($antrader=="20 rader pr side"){$rec_limit=20;}
	    if ($antrader=="25 rader pr side"){$rec_limit=25;}
	    if ($antrader=="30 rader pr side"){$rec_limit=30;}
	  
	    $sql = "SELECT count(TransactionID) FROM {$table4}";

    
      $sql = $sql." Where CreatedDate >='{$datofra}' AND CreatedDate<='{$datotil}'";
      
	  

      $substr = "Alle kontrollere";
      if (strpos($kontr, $substr) === false) {
         $sql = $sql." and ControlName='{$kontr}'";
      }

      $substr = "Alle brukere";
      if (strpos($brukere, $substr) === false) {
         //$brID = hentbrukerident($brukere);
         $brID=1; 
         $sql = $sql." and UserID='{$brID}'";
      }

      if ($svarsp=="1"){
         $sql = $sql." and Answer='Ja'";
      }

      if ($svarsp=="2"){
        $sql = $sql." and Answer='Nei'";
      }

      if ($svarsp=="3"){
        $sql = $sql." and Answer<>'Ja' and Answer<>'Nei' ";
      } 
	  
      $retval = mysql_query($sql);
      if(!$retval)
      {
        die('Could not get data: ' . mysql_error());
      }
     
	  $row = mysql_fetch_array($retval, MYSQL_NUM );
      $rec_count = $row[0];

	  if ($rec_count>0)
      {
       $antsider = intval($rec_count/$rec_limit)+1;
      }

       $offset = ($rec_limit * $side);
      
     
	 	   	 
 
     $left_rec = $rec_count - ($side * $rec_limit);
	 
     
	 $sql = "Delete from {$table3} WHERE UserID='{$brukerID}' and Organosation='{$kundeid}'";
	 $res = sqlsrv_query( $conn,$sql); 
	 
// Lagre rapport parametere
     $tsql_callSP = "{call SAVE_Reportparameters( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
     $params = array( 
               array($datofra, SQLSRV_PARAM_IN),
               array($datotil, SQLSRV_PARAM_IN),
               array($kontr, SQLSRV_PARAM_IN),
               array($brukere, SQLSRV_PARAM_IN),
               array($svarsp, SQLSRV_PARAM_IN),
               array($vilkenrapport, SQLSRV_PARAM_IN),
               array($rec_count, SQLSRV_PARAM_IN),
               array($brukerID, SQLSRV_PARAM_IN),
               array($kundeid, SQLSRV_PARAM_IN),
               array($antrader, SQLSRV_PARAM_IN),
               array($side, SQLSRV_PARAM_IN)
               );

/* Execute the query. */
     $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
     if( $stmt3 === false )
     {
         echo "Error in executing statement 3.\n";
         die( print_r( sqlsrv_errors(), true));
     }
     else
     {sqlsrv_free_stmt( $stmt3);}
    
   }
   else
   {
   
  
	 
    $query = "SELECT * FROM {$table3} WHERE UserID='{$brukerID}' and Organisation='{$kundeid}'";
//execute the SQL query and return records
    $resultraptmp = sqlsrv_query( $conn,$query); 
// Parameter for rapport
    while($row3 = sqlsrv_fetch_array($resultraptmp)){

        $datofra = $row3['Datefrom'];
		    $datotil = $row3['Dateto'];
		    $kontr = $row3['Controllername'];
		    $brukere = $row3['Username'];
    		$svarsp = $row3['Answer'];
    		$vilkenrapport = $row3['Report'];
    		$antsider = $row3['Pages'];
    		$rec_count = $row3['Numberrecords'];
    		$antrader = $row3['NumRows'];
    		$datobrukes = 1;
    		$side = $row3['Page'];
	  }	
     
	  if ($antrader=="10 rader pr side"){$rec_limit=10;}
	  if ($antrader=="15 rader pr side"){$rec_limit=15;}
	  if ($antrader=="20 rader pr side"){$rec_limit=20;}
	  if ($antrader=="25 rader pr side"){$rec_limit=25;}
	  if ($antrader=="30 rader pr side"){$rec_limit=30;}
	 
	  if (isset($_GET["naviger"])){$naviger = $_GET["naviger"];}
	  else {$naviger="no";}
	 

	  $svarsp=-1;
	  if (isset($_GET["viserapport"])) {$viserapport = $_GET["viserapport"];}
	  else {$viserapport=0;}
	

      if ($naviger=="forste"){ $side=0;}
      if ($naviger=="forrige"){ if ($side>=1){$side = ($side -1);}}
      if ($naviger=="neste")
	  { 
	    if ($side<$antsider)
		{
		   $side = ($side +1);
		}
	 }
     if ($naviger=="siste"){ $side=$antsider-1;} 

   // Hent Organisation    
        $tsql_callSP = "{call UPDATE_Report( ?, ?, ?)}";
        $params = array( 
                  array($brukerID, SQLSRV_PARAM_IN),
                  array($kundeid SQLSRV_PARAM_IN),
                  array($side, SQLSRV_PARAM_IN)
                  );
    
    

/* Execute the query. */
        $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
        if( $stmt3 === false )
        {
           echo "Error in executing statement 3.\n";
           die( print_r( sqlsrv_errors(), true));
        }
        else
        {sqlsrv_free_stmt( $stmt3);}   

 	 
       $offset = ($rec_limit * $side);
	     $left_rec = $rec_count - ($side * $rec_limit);
	 
   }
	 
	 	 
}
else
{
       header("location: login.php");
	    exit;
}

?>
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8" />
<title>Agrippa report system 2</title>
<link href="css/redmond/jquery-ui-1.8.13.custom.css" rel="stylesheet" />
<script src='js/jquery.min.js' type='text/javascript'></script>

<!-- jQuery Plugin -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
 
<!-- Preloader --><script type="text/javascript">// <![CDATA[
$(window).load(function() { $("#spinner").fadeOut("slow"); })
// ]]></script>

<script type="text/javascript">
function showValue(num){
	var result = document.getElementById('result');	
	result.innerHTML = num;
}
</script>

</head>

<body>
<link rel="stylesheet" href="reportcss.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<!-- Preloader -->
<div id="spinner"></div>

<header>
<table width="100%" align="left" border="0" padding-right="10px" class="headertabell">
<tr class="rapport1_del5">

<td class="rapport1_del5" align="left">
<a href="#" target="_self"><img src="../images/excel.png" align="left"/> Excel </a></td>
<td class="rapport1_del5" align="left">
<a href="#" target="_self"> <img src="../images/skriver.png" TYPE="button" align="left" onClick="window.print()" /> Printer </a></td>
<td class="rapport1_del5" align="left">
<a href="MPDF/examples/PDF6.php?brukerID=<?php echo $brukerID ?>&kundeid=<?php echo $kundeid ?>" target="_self"><img src="../images/PDF.png" align="left"/> PDF </a></td>

</tr>
</table>
</header >

</br>

 <form class="formqueryform" action="<?php $_PHP_SELF ?>" method="POST">
    <table width="100%" align="left" class="formsql">
	
	<tr class="blank_row_noborder">
      <td colspan="3"></td>
    </tr>

	<tr class="blank_row_noborder">
      <td colspan="3"></td>
    </tr>	
	
	<tr>
        <td  class="rapport1_del3" align="right">Dato:</td>
		<td align="left">
		   <input type="date" name="Datefrom" id="date" value=<?php echo $datofra ?> class="formreports" /> 
           <input type="date" name="Dateto" id="Dateto" value=<?php echo $datotil ?> class="formreports" /> 
		</td>
	</tr>
	<tr>
	<td  class="rapport1_del3" align="right">Kontroller:</td>
	<td align="left">
  	  <select id="recipient" name="kontroller" class="selmenu">
  						<option>Alle kontrollere</option>
                  <?php


                     $query = "SELECT distinct(ControlName) FROM {$table1} WHERE UserID='{$brukerID}' and Organisation='{$kundeid}'";
//execute the SQL query and return records
                     $resultraptmp = sqlsrv_query( $conn,$query); 
// Parameter for rapport
                     while($row3 = sqlsrv_fetch_array($resultraptmp)){
 
                        $navnkon = $row3['ControlName'];
						            echo "<option ";
                        if($kontr == $navnkon) echo ' selected="selected"';
                         echo ">$navnkon</option>"; 
	?>
                   
                     
	  
<?php
}
?>		
</select>
	</td>
	</tr>

	<tr>
	<td  class="rapport1_del3" align="right">Bruker:</td>
	<td align="left">
  	  <select id="recipient" name="brukere" class="selmenu">
  						<option>Alle brukere</option>
                  <?php

                     $query = "SELECT Name FROM {$table2} WHERE Organisation='{$kundeid}'";
//execute the SQL query and return records
                     $resultraptmp = sqlsrv_query( $conn,$query); 
// Parameter for rapport
                     while($row3 = sqlsrv_fetch_array($resultraptmp)){

                        $navnbruker = $row3['Name'];
						
						echo "<option ";
                        if($brukere == $navnbruker) echo ' selected="selected"';
                        echo ">$navnbruker</option>"; 
?>
                   
	  
<?php
}
?>		
	  </select>
	</td>
	</tr>
	<tr>
    <td  class="rapport1_del3" align="right">Svar:</td>
    <td>
	<select id="recipient" name="svar" class="selmenu">
	<?php
				        echo "<option ";
                        if("Alle" == $svarsp) echo ' selected="selected"';
                        echo ">Alle</option>"; 
						
						echo "<option ";
                        if("Ja" == $svarsp) echo ' selected="selected"';
                        echo ">Ja</option>"; 
						
						echo "<option ";
                        if("Nei" == $svarsp) echo ' selected="selected"';
                        echo ">Nei</option>"; 
						
		                echo "<option ";
                        if("Scale" == $svarsp) echo ' selected="selected"';
                        echo ">Scale</option>"; 
    ?>
    </select>   
    </td>
	</tr>
	
	<tr>
	   <td  class="rapport1_del3" align="right">Rapport:</td>
	   <td>
	   <select id="recipient" name="Rapport" class="selmenu">
	   
	   	<?php
				        echo "<option ";
                        if("Standard rapport" == $vilkenrapport) echo ' selected="selected"';
                        echo ">Standard rapport</option>"; 
						
						echo "<option ";
                        if("Enkel rapport" == $vilkenrapport) echo ' selected="selected"';
                        echo ">Enkel rapport</option>"; 
						
        ?>
	   </select>
	   </td>
	</tr>
	<tr>
	   <td  class="rapport1_del3" align="right">Antall rader:</td>
	   <td>
       	   <select id="recipient" name="antrader" class="selmenu">
                  <?php
				        echo "<option ";
                        if("10 rader pr side" == $antrader) echo ' selected="selected"';
                        echo ">10 rader pr side</option>";
				  
				  		echo "<option ";
                        if("15 rader pr side" == $antrader) echo ' selected="selected"';
                        echo ">15 rader pr side</option>";
						
						echo "<option ";
                        if("20 rader pr side" == $antrader) echo ' selected="selected"';
                        echo ">20 rader pr side</option>";
						
						echo "<option ";
                        if("25 rader pr side" == $antrader) echo ' selected="selected"';
                        echo ">25 rader pr side</option>";
						
						echo "<option ";
                        if("30 rader pr side" == $antrader) echo ' selected="selected"';
                        echo ">30 rader pr side</option>";
				  
				  
				  
				  
				  ?>
						
 
	       </select>
	   </td>
	</tr>
	<tr>
	<td class="rapport1_del4" align="right"></td>
	<td>
	<section id="buttons">
			<!--<input type="reset" name="reset" id="resetbtn" class="resetbtn" value="Reset"> -->
			<input type="submit" name="submit" id="submitbtn" class="submitbtn" value="Søk">
			<br style="clear:both;">
		</section>
	</td>
	</tr>
	
	<tr class="blank_row_noborder">
      <td colspan="3"></td>
    </tr>	
	
	<tr class="blank_row_noborder">
      <td colspan="3"></td>
    </tr>	
   
   </table>
	</form>  

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
   (function() {
      var elem = document.createElement('input');
      elem.setAttribute('type', 'date');
	  

      if ( elem.type === 'text' ) {
         $('#date').datepicker({
            dateFormat: 'yy-mm-dd',
            // defaultDate: +5
         }); 
		 $('#Dateto').datepicker({
            dateFormat: 'yy-mm-dd',
            // defaultDate: +5
         }); 
      }
   })();

</script>

<br>
</br>


<?php

if ($viserapport==1) { 	

$sql = "SELECT ControlName,LocationID,ControlID,Organisation,Question,Note,CreatedDate,Answer,UserID,QuestionID FROM {$table4}";


$sql = $sql." Where CreatedDate >='{$datofra}' AND CreatedDate<='{$datotil}'";


$substr = "Alle kontrollere 2";
if (strpos($kontr, $substr) === false) {
  $sql = $sql." and ControlName='{$kontr}'";
}

$substr = "Alle brukere";
if (strpos($brukere, $substr) === false) {
  $brID = hentbrukerident($brukere);
  $sql = $sql." and UserID='{$brID}'";
}

if ($svarsp=="Ja"){
  $sql = $sql." and Answer='Ja'";
}

if ($svarsp=="Nei"){
  $sql = $sql." and Answer='Nei'";
}

if ($svarsp=="Scale"){
  $sql = $sql." and Answer<>'Ja' and Answer<>'Nei' ";
}



$sql = $sql." ORDER BY K_ID LIMIT {$offset}, {$rec_limit}";

$resultraptmp = sqlsrv_query( $conn,$sql); 

$TMP_KID=0;
$forstekontroller = 1;
$TMP_LOK=0;

$farge1="#ffffff";
$farge2="#d9eefa";
$valgfarge="#ccc";
$byttfarge = 1;

?>

<?php
 while($row3 = sqlsrv_fetch_array($resultraptmp)){
   
   $kontrollernavn = $row3['ControlName'];
   $lokasjonnr = $row3['LocationID'];
   $K_ID = $row3['ControlID'];
   $kunde_ID = $row3['Organisation'];
   $lokasjonnavn = $row3['Location'];	
   $sporsmal = $row3['Question'];
   $kommentar = $row3['Note'];
   $transdato = $row3['CreatedDate'];
   $svar = $row3['Answer']; 
   $usID = $row3['UserID'];  
   $scaleant = $row3['IsScale'];
   $bilderef="";     // Midligtidig satt til blank
   $brukernavn="";
 // Hent brukernavn  

   $tsql_callSP = "{call GET_Username( ?, ?)}";
   $params = array( 
                 array($usID, SQLSRV_PARAM_IN),
                 array($brukernavn, SQLSRV_PARAM_INOUT)
               );

/* Execute the query. */
   $stmt3 = sqlsrv_query( $conn, $tsql_callSP, $params);
   if( $stmt3 === false )
   {
       echo "Error in executing statement 3.\n";
       die( print_r( sqlsrv_errors(), true));
   }
   else
   {sqlsrv_free_stmt( $stmt3);}   

   ?>   
   
<?php   
if ($vilkenrapport=="Standard rapport"){   
   if ($forstekontroller==1)
	  {
	     $forstekontroller=0;
		 $TMP_KID = $K_ID;
		 $TMP_LOK = $lokasjonnr;
	?>      
        <table width="100%" align="center" class="testtabell"> 
		<tr>
		  <td class="rapport1_del1" height="40px" colspan="4"><?php echo $kontrollernavn; ?></td>
		</tr>
		<tr>
	  	  <td class="rapport1_del2" colspan="3" height="40px"><?php echo $lokasjonnavn; ?> </td>
          <td class="rapport_brukernavn" align="right"><?php echo $brukernavn; ?></td>		  
	    </tr>
	<?php
	  }
	?>

<?php	
   if ((($TMP_KID<>$K_ID) or ($TMP_LOK<>$lokasjonnr)) and $forstekontroller==2)
   {
      if ($TMP_KID<>$K_ID) {$TMP_KID = $K_ID;}
	  if ($TMP_LOK<>$lokasjonnr) {$TMP_LOK = $lokasjonnr;} ?>
     </table>
        <table width="100%" align="center" class="testtabell"> 
		<tr>
		  <td class="rapport1_del1" colspan="4" height="40px"><?php echo $kontrollernavn; ?></td>
		</tr>
		<tr>
	  	  <td class="rapport1_del2" colspan="3" height="40px"><?php echo $lokasjonnavn; ?></td>
		   <td class="rapport_brukernavn" align="right"><?php echo $brukernavn; ?></td>
	     </tr>	 
<?php
   }
?>   



	
    <tr class="blank_row_noborder">
      <td colspan="4"></td>
    </tr>	
	
	<tr>  
	  <td  class="rapport1_del3" align="right" valign="top"> Sporsmål: </td>
	  <td class="rapport1_del3" valign="top"> <?php echo $sporsmal;?> </td>
	  <?php
	     if ($bilderef=="")
		 { ?>
		   <td class="rapport1_del3" valign="top"></td> 
	       <td valign="top" class="rapport_image1" rowspan="4"><img src="../images/ingen.png" height="160" align="right" /></td>
	       
		 <?php
		   }
		   else
		   {
		   ?>
		     <td class="rapport1_del3" valign="top"></td>
		     <td valign="top" class="rapport_image1" rowspan="4"><img src="../uploads/<?php echo $bilderef; ?>" height="160" align="right" /></td>
	        
		   <?php
		   }
		   ?>
		   
	</tr>  
	<tr>
	  <td  class="rapport1_del3" align="right" valign="top"> Dato: </td> 
	  <td  class="rapport1_del3" valign="top"><?php echo $transdato; ?></td>
	</tr>
	
	<tr> 
	  <td  class="rapport1_del3" align="right" valign="top"> Svar:</td> 
	  <?php 
	    if (($svar=="Ja") or ($svar=="Nei"))
		{ ?>
	       <td  class="rapport1_del3" valign="top"><?php echo $svar; ?></td>
		<?php
		}
		else {
		?>
		   <td  class="rapport1_del3" valign="top"><?php echo $svar; ?> av <?php echo $scaleant; ?></td>
		<?php }
		?>
	</tr>
	
	<tr> 
	  <td  class="rapport1_del3" align="right" valign="top"> Kommentar:</td> 
	  <td  class="rapport1_del3" valign="top"><?php echo $kommentar; ?></td>
	</tr> 
	
	<tr class="blank_row">
      <td colspan="4"></td>
    </tr>	

<?php
   
   $forstekontroller=2;
?>   
		

<?php
} 
else { ?>
      <?php 
          if ($forstekontroller==1)
	  {
	     $forstekontroller=0;
		 $TMP_KID = $K_ID;
		 $TMP_LOK = $lokasjonnr;
	  ?>     
		
        <table width="100%" align="left" class="testtabell"> 
		<tr>
		  <th class="rapport2_header" height="40px" align="left">Kontroller</th>
		  <th class="rapport2_header" height="40px" align="left">Lokasjon</th>
		  <th class="rapport2_header" height="40px" align="left">Dato</th>
		  <th class="rapport2_header" height="40px" align="left">Spørsmål</th>
		  <th class="rapport2_header" height="40px" align="left">Svar</th>
		  
		  </tr>
		<?php }?>


	  <?php
        if ($byttfarge==1){
           $valgfarge=$farge2;
           $byttfarge=2;
        }
        else
        { 
           $byttfarge=1;
           $valgfarge=$farge1;
        } ?>

		
         <tr>
		                                                 
	      <td class="rapport1_del8" bgcolor="<?php echo $valgfarge;?>" align="left"> <?php echo $kontrollernavn; ?></td> 
	      <td class="rapport1_del8" bgcolor="<?php echo $valgfarge;?>" align="left"><?php echo $lokasjonnavn; ?></td>
		  <td class="rapport1_del8"  bgcolor="<?php echo $valgfarge;?>" align="left"><?php echo $transdato; ?></td>
		  <td class="rapport1_del8"  bgcolor="<?php echo $valgfarge;?>" align="left"><?php echo $sporsmal; ?></td>
		  <?php
		     if($svar=="Ja"){ ?>
		        <td class="rapport1_del9"  bgcolor="<?php echo $valgfarge;?>" align="left"><?php echo $svar; ?><img src="../images/jasvar.png" alt="Smiley face" align="right"></td>
		     <?php }?>
			 
		  <?php
		     if($svar=="Nei"){ ?>
		        <td class="rapport1_del9"  bgcolor="<?php echo $valgfarge;?>" align="left"><?php echo $svar; ?><img src="../images/neisvar.png" alt="Smiley face" align="right"></td>
		     <?php }?>

		  <?php
		     if($svar<>"Ja" and $svar<>"Nei"){ ?>
		        <td class="rapport1_del9"  bgcolor="<?php echo $valgfarge;?>" align="left"><?php echo $svar; ?> av <?php echo $scaleant; ?><img src="../images/scale.png" alt="Smiley face" align="right"></td>
		     <?php }?>
		  
	     </tr>		 
		  

<?php }?>



<?php
} }
if (($vilkenrapport=="Enkel rapport") and ($viserapport==1)){ ?>
   <tr>
       <td class="rapport1_del9"  bgcolor="<?php echo $valgfarge;?>" colspan="5" align="center">Transaksjoner : <?php echo $rec_count; ?></td> 
   </tr>
   </table>
<?php }?>


<?php
if($viserapport==1){?>

<table align="center">
<tr> <td class="rapport1_del3" valign="top"></td>  </tr>
<tr> <td class="rapport1_del3" valign="top"></td>  </tr>
<tr> <td class="rapport1_del3" valign="top"></td>  </tr>
<tr>
<td class="rapport1_del6_4"> <a href="agrippareports.php?naviger=forste&viserapport=1" target="_self"> <img src="../images/b1.png" onmouseover="this.src='../images/b12.png'"
onmouseout="this.src='../images/b1.png'" align="left"/></a> </td>
<td class="rapport1_del6_2"> <a href="agrippareports.php?naviger=forrige&viserapport=1" target="_self"> <img src="../images/b2.png" onmouseover="this.src='../images/b22.png'"
onmouseout="this.src='../images/b2.png'" align="left" /></a> </td>
<?php
  if ($antsider==0){
  ?>
<td class="rapport1_del6_2"> <input class="txtboxsider" type="text" id="email" value = "<?php echo $side; ?> av <?php echo $antsider; ?>" align="right" /></td>
<?php }
else {
?>
<td class="rapport1_del6_2"> <input class="txtboxsider" type="text" id="email" value = "<?php echo $side+1; ?> av <?php echo $antsider; ?>" align="right" /></td>
<?php }?> 
<td class="rapport1_del6_2"> <a href="agrippareports.php?naviger=neste&viserapport=1" target="_self"> <img src="../images/b3.png" onmouseover="this.src='../images/b32.png'"
onmouseout="this.src='../images/b3.png'" align="left" /></a> </td>
<td class="rapport1_del6_3"> <a href="agrippareports.php?naviger=siste&viserapport=1" target="_self"> <img src="../images/b4.png" onmouseover="this.src='../images/b42.png'"
onmouseout="this.src='../images/b4.png'" align="left" /></a> </td>
</tr>
<tr> <td class="rapport1_del3" valign="top"></td>  </tr>
<tr> <td class="rapport1_del3" valign="top"></td>  </tr>
</table>

<?php }?>



</body>
</html> ?>

Open in new window

0
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39674528
Eight hundred and two lines of code?

Parse error: syntax error, unexpected 'SQLSRV_PARAM_IN' (T_STRING), expecting ')' in /home/websitet/public_html/RAY_temp_foo.php on line 227
0
 
LVL 2

Author Comment

by:team2005
ID: 39674577
Hi Ray!

How do you get that error message ?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39674653
I have error_reporting enabled on my server.  Go back and check this:

http://www.experts-exchange.com/Microsoft/Development/Q_28302905.html#a39674464
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Author Comment

by:team2005
ID: 39674682
Hi!

Have tryed this:

ini_set('display_errors', TRUE);

But dosent get me any errors ?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39674767
Who is your hosting company?
0
 
LVL 2

Author Comment

by:team2005
ID: 39674791
Hi!

I am helping a customer, dont know what the hosting company is
0
 
LVL 12

Expert Comment

by:zappafan2k2
ID: 39674864
require_once('Connect_databse.php');

Open in new window

Any chance that could be a typo?  There are three 'A's in the databAse.  And since you've required it, maybe the script is failing at that point?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39674880
@zappafan2k2:  That may be wrong, also, but at this point it's a parse error, which is a compile-time failure.  In order for the require_once() to fail in a run-time failure, we would have had to actually run through the compile successfully and attempted to execute the script.  And at this point we would not get to the require_once() because require_once() is on line 9 and the script dies on line 5.
0
 
LVL 34

Expert Comment

by:gr8gonzo
ID: 39674917
One other thought - sometimes I have to work in environments where I can't control some of the error reporting. In those cases, I usually run a syntax check locally on my computer.

1. I have the Windows version of PHP downloaded onto my computer in a local folder (e.g. C:\php54), so I have the php.exe file.

2. I put the PHP script file (e.g. foobar.php) into the same folder with php.exe.

3. I go to the command prompt and run:
cd\php54
php -l foobar.php

That is a lower-case L. That's a "lint" check and it's basically a simple syntax check without actually running the file. It should catch any errors due to bad syntax (e.g. missing line endings or semicolons, etc...).
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39674921
Good suggestion, Jonathan, and Happy Thanksgiving to you and yours!
0
 
LVL 12

Expert Comment

by:zappafan2k2
ID: 39674933
@Ray: you're right of course.  Stupid blunder on my part.

And line 227 looks like it needs a comma.
array($kundeid SQLSRV_PARAM_IN),

Open in new window

Shouldn't that be
array($kundeid, SQLSRV_PARAM_IN),

Open in new window

or were you waiting for the OP to catch it him/herself?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39674962
You're probably right about the array statement.  I haven't got the time today to understand the script.  And I think at the root of it all, there is a bigger issue here than just this one syntax error, and that's the inability for the OP to get any error information.  PHP compiler stops at the first syntax error.  And with 802 lines of code it's quite probable that there are other errors.  If the errors cannot be visualized, they can't be fixed.  So my "step one" is to get some method of error visualization.  This will go beyond just the parse errors; my guess is that the run-time errors will also be suppressed from browser visibility.

In a current project for a client hosted on GoDaddy, there is no error visualization, however we were able to add this to the php.ini file.
log_errors = On
log_errors_max_len = 1024
error_log = error_log

Open in new window

Now when a script fails, we get the white screen of death, but I can just make an FTP copy of the error_log file and look at it on my development screen.

Once nice advantage of the error_log is that you can use trigger_error() and error_log() to deal with run-time exceptions.  Once we can see the errors, that's the first step to getting the OP on the road to success.
0
 
LVL 2

Author Comment

by:team2005
ID: 39675368
Hi!

Fixed the missing , here ->  
array($kundeid SQLSRV_PARAM_IN),

Open in new window



And noe i get an error message:

Error in executing statement 3. Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 8114 [code] => 8114 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Error converting data type nvarchar to bigint. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Error converting data type nvarchar to bigint. ) ) 

Open in new window



But what line ???
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 39675418
One of 5 lines output that error:

45
65
166
237
584

Maybe change the output message to help you track it down.

I guess my suggestion to add bits into your working file until it broke fell on deaf ears!!
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39675482
... deaf ears!!
:-)

Whenever we get 800+ lines of code that doesn't work, you can bet there are more than a few things wrong!

Here is one way that might help you isolate the problem.  You can print out the query string, as well as the error message.  You can print out the value of __LINE__.  But if this were my script, I would scrap it entirely and start over with parts that I know work.  That is usually faster than trying to learn what a script is doing, then deconstruct it to remove errors.
0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39700419
thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Router for PHP reqeusts 12 32
PHP and Soap 3 28
Wordpress type image upload 10 29
confirm popup before record delete takes place 87 24
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now