Jump to content

wampserver php settings


Recommended Posts

i have a script that works fine at work. i brought the site home to work on but a script dosent work at home.

the script uses a lot of "$_get" as its a script to pull info from the database in bulk.

i no i can use "isset" to get this to work but i wanted to work out the settings in wampser / php.ini thats causing this.

 

when trying to view the page its as if the page dose not exist.

apache log showing "undefined index on line ( matches to the gets)"

 

script thats playing up (works fine on company intranet site)

<?php
include("config.php"); 
include("http://jgscov/dsgi/includes/header.html");

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql = "SELECT make, COUNT(*) AS total, SUM(IF(comments = 'pass', 1, 0)) AS withComments, SUM(IF(comments not like 'pass', 1, 0)) AS withnotval FROM dsgi_serval GROUP BY make ORDER BY COUNT(*) DESC"; 
$result=mysql_query($sql);
?>
<tr>
  <td><table width="200" border="1" align="left" bordercolor="orange" id="center">
  <tr>
	<td colspan="4">Server Status</td>
  </tr>
  <tr>
	<th width="137" >Make</th>
	<th width="85" >Total</th>
	<th width="75" >Validated</th>
	<th width="75" >Not Validated</th>
  </tr>
  <?php
while($rows=mysql_fetch_array($result)){
?>
  <tr>
	<td><div align="center"><?php echo $rows['make']; ?></div></td>
	<td><div align="center"><a href="?make=<?php echo $rows['make'];?>&status=all"><?php echo $rows['total']; ?></div></td>
	<td><div align="center"><a href="?make=<?php echo $rows['make'];?>&status=pass"><?php echo $rows['withComments']; ?></a></div></td>
	<td><div align="center"><a href="?make=<?php echo $rows['make'];?>&status=notpass"><?php echo $rows['withnotval']; ?></a></div></td>
  </tr>
  <?php
}
?>
  <tr>
	<td><div align="center">Totals</div></td>
	<td><div align="center">
		<?php
// counts all rows
	   $query = "SELECT * FROM dsgi_serval " ;
       $result = mysql_query($query) ;
       $numrows = mysql_num_rows($result) ;

	   
//		   while($row1 = mysql_fetch_array($result1)){
?>
		 <a href="?make=all"><?php echo $numrows?></a>
<?php           

?>
	  </div></td>
	<td><div align="center">
		<?php

// counts validated		   
	   $query = "SELECT * FROM dsgi_serval where comments like 'pass'";
       $result = mysql_query($query) ;
       $numrows = mysql_num_rows($result) ;

		   
?>
		 <a href="?make=pass"><?php echo $numrows?></a>
<?php

?>
	  </div></td>
	<td><div align="center">
		<?php

// counts not validate
	   $query = "SELECT * FROM dsgi_serval where comments not like 'pass'";
       $result = mysql_query($query) ;
       $numrows = mysql_num_rows($result) ;

		  
?>
		 <a href="?make=notpass"><?php echo $numrows?></a>
<?php

?>
	  </div></td>
  </tr>
</table>
</div></td>
</tr>
</table>
<?php

if ($_GET['make'] == '1'){
  //no input
}
	  //all
		   elseif ($_GET['make'] == 'all'){      
		  $table = $result6 = mysql_query("SELECT * FROM dsgi_serval");
}
			  //pass
			   elseif ($_GET['make'] == 'pass'){      
			   $table = $result6 = mysql_query("SELECT * FROM dsgi_serval where comments like 'Pass'");
}					   
					//not pass
					elseif ($_GET['make'] == 'notpass'){
					$table = $result6 = mysql_query("SELECT * FROM dsgi_serval where comments not like 'pass'");
}						
								//make validated
								elseif ($_GET['status'] == 'pass'){
								$table = $result6 = mysql_query("SELECT * FROM dsgi_serval where make like '{$_GET['make']}' and comments like 'pass'");
}						
									//make not validated
									elseif ($_GET['status'] == 'notpass'){
					  			$table = $result6 = mysql_query("SELECT * FROM dsgi_serval where make like '{$_GET['make']}' and comments not like 'pass'");

}else{         
	  //by make                 
	 $table = $result6 = mysql_query("SELECT * FROM dsgi_serval where make like '{$_GET['make']}'");
}
if ($table == '1'){
}else{

  ?>
  
<div id="right">

  <?php
  
$table
or die(mysql_error()); 
$result=mysql_query($sql);
?>
  </p>
  <table width="800" bordercolor="orange" border="1" align="center" id="right">
<tr>
  <td colspan="10"><div align="center"><font size="4" face="Verdana"> <?php echo"'{$_GET['make']}'" ?> Validation Status </font></div></td>
</tr>

<tr>
  <th align="center"> Sku</th>
  <th align="center"> Orig Sku</th>
  <th align="center"> Make</th>
  <th align="center"> Model</th>
  <th align="center"> Comments</th>
  <th align="center"> Sound</th>
  <th align="center"> Graphics</th>
  <th align="center"> Recovery</th>
  <th align="center"> Date</th>
</tr>
<?php


?>
<?php
while($rows=mysql_fetch_array($result6)){

$case = strtoupper($rows['comments']);

if ($case == 'PASS')
{
	$bgc="#33ff00";
}
else
{
	$bgc="#FF6600";
}
?>
<tr bgcolor=<?php echo $bgc;?>>
  <td><div align="center"> <?php echo $rows['sku']; ?></div></td>
  <td><div align="center"> <?php echo $rows['rsku']; ?></div></td>
  <td><div align="center"> <?php echo $rows['make']; ?></div></td>
  <td><div align="center"> <?php echo $rows['model']; ?></div></td>
  <td><div align="center"> <?php echo $rows['comments']; ?></div></td>
  <td><div align="center"> <?php echo $rows['sound']; ?></div></td>
  <td><div align="center"> <?php echo $rows['gfx']; ?></div></td>
  <td><div align="center"> <?php echo $rows['recovery']; ?></div></td>
  <td><div align="center"> <?php echo $rows['date']; ?></div></td>
</tr>
<?php
}
}

?>
<tr>
<td><div align="center"><a href="exceltest.php?make=<?php //echo"{$_GET['make']}" ?>&status=<?php //echo"{$_GET['status']}" ?>">Export to Excel</div></td>
</tr>
  </table>
  
  
  
  
  
  <?php
mysql_close();
?>

Link to comment
Share on other sites

i no i can use "isset" to get this to work but i wanted to work out the settings in wampser / php.ini thats causing this.

 

Obviously display_errors is off and/or the error_reporting level is set far too low on your work server for development purposes. The code itself should be fixed. It's very inefficient to have php generating errors, even if they are hidden.

Link to comment
Share on other sites

theres 2 people at work (including me) that work on the intranet site. the other guy does the company intranet and i do my lines site.

 

its a bug bear of mine that he wont get the error reporting turned on as when a script wont work i have little info to trouble shoot the problem. he prefers a blank page to an error message showing to people.

 

it took me  2 mnths to convince him to get the server to look for an index file.

 

thanks for info and ill get on wr-writting my files.

Link to comment
Share on other sites

he prefers a blank page to an error message showing to people.

 

You should be working within a 'dev' environment and not on the live code base. I don't even have access to our live code base at work, couldn't edit it if I wanted to.

Link to comment
Share on other sites

i do have 2 working enviroments.

my home pc and my work pc. both are set up with wampserver but unless there configured exactly like the "live" server you will get errors.

 

when i put scripts on the live server i always rename them and test them before they go "live" in either a working dir or if theres include files in the live dir.

 

i learnt the mistake of working on live files many years ago.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.