Bent Stigsen wrote:
Craig Morrison wrote:
[snip] Touchy? I don't think so.
Is there any error in the code? If there is, by all means point it out.
That *is* the point behind posting it.
I allready did point out what I thought, but you'll probably just call me an
ass again, if I repeat it.
You seem to be on the track that I am trying to find fault here, which
is an error. I am not. So get over that.
I am simply trying to understand the behavior.
I don't understand why you think there is a "behavior". There is nothing
exotic in what you are trying to do. Too common a task, for there to be an
oddity that everybody else is missing.
If you find it to be some funky bug in PHP, then I will unreservedly
apologize for anything you find fit. Alternatively when you find it to be
some banal mistake in your code, I hope you'll find it in you to forgive
my bruteness.
I still don't have an answer to the original query though.
As it stands, the app works and I may very well be being quite pedantic
about the whole mess but I would like some insight as to why the notice
is thrown. Which was the whole point behind this thread.
I showed the code that was throwing the notice and you (or anyone else)
have shed no light on the problem. I don't know what else I can do or
show to make it any clearer what is happening.
You present your conclusions of what is happening and pieces of code you say
is involved. No offense meant, but I can't take that as certainty. I really
don't know any other way of putting it than, you must have overlooked
something, doing something or making assumptions that you consider
unimportant. If this pisses you off, then by all means call me a moron, and
I shall not bother you again.
/Bent
Why don't you just say that you don't know?
Or is it that you just feel a need to be verbose for no reason?
Here is the entire mess of code.. You tell me why the notice is thrown
if you can, otherwise shut the fuck up.
<!---------- begin index.php ---------->
<?
include 'inc/config.inc.php';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Stroud Group - Per Month Email Statistics : <? echo
$id_text[$id_option]; ?></title>
<style type="text/css">
<!--
div.cen_page { margin: auto; width: 428px; }
div.copy { margin: auto; text-align: center; }
img.chart { border: 1px solid black; }
table.outer { border: solid 1px #000000; }
table.inner { border-collapse: collapse; margin: 1px; }
th { border-bottom: 1px solid #000000; text-align: left;
background-color: #CCCCCC; }
th.no { width: 15%; text-align: center; }
td.no { width: 15%; text-align: right; padding-right: 10px; }
th.mo { width: 25%; }
td.mo { width: 25%; text-indent: 3px; }
th.us { width: 40%; }
td.us { width: 40%; text-indent: 3px; }
th.mb { width: 20%; text-align: center; }
td.mb { width: 20%; text-align: right; padding-right: 20px; }
tr, td, th { padding: 1px 0px 2px 0px; }
td#trline { border-top: 3px double #000000; border-bottom: 1px solid
black; }
#odd { background: #DDDDDD; }
body, tr, td, th, select, option, input { font-family: Verdana, Geneva,
Arial, Helvetica, sans-serif; font-size: 9px; }
/* IE hack for option vertical centering */
* html input { padding-top:10px; }
input.img { margin-bottom: -3px; }
/* IE hack for img button vertical centering */
* html input.img { margin-bottom: -2px; }
-->
</style>
<script language="javascript">
function nav () {
document.form_data.submit();
}
</script>
</head>
<body>
<div class="cen_page">
<img style="border: none; float: left;" src="images/stroud-logo-big.gif">
<div style="float: right;">
<form method="POST" action="<? echo $_SERVER['PHP_SELF'];?>"
name="form_data">
<p><select size="1" name="D1" onChange="nav();">
<?
for ($i=1; $i <= $id_text_count; $i++) {
print "<option ";
if ($id_option == $i)
print "SELECTED ";
print "value='$i'>" . $id_text[$i] . "</option>\n";
}
?>
</select><input class="img" type="image" src="images/go.ico"
value="Submit" alt="Submit" name="B1"></p>
</form>
</div>
<?php
$db="mailstats";
$link = mysql_connect(...);
if (! $link) die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM $selectID" ) or die("SELECT Error:
".mysql_error());
$fc = mysql_num_fields($result);
$tab_width = $fc * 105; // 420 / 4 = 105, so that's a baseline
print '<br style="clear: both;">';
print "<table class='outer'><tr><td>\n";
print "<table class='inner' width='".$tab_width."px'>\n";
print "<tr>\n";
for ($i=0; $i<$fc; $i++) {
$col_style[$i] = $fc_col_styles[mysql_field_name($result, $i)];
print "<th class='".$col_style[$i]."'>" . mysql_field_name($result, $i)
.. "</th>\n";
}
print "</tr>\n";
$i = 0;
while ($get_info = mysql_fetch_row($result)){
$i++;
if (($i & 1) == 1)
print "<tr>\n";
else
print "<tr id='odd'>\n";
$j = 0;
foreach ($get_info as $field) {
if ($j == 0) {
$fval = number_format($field, 0);
printf("\t<td class='%s'>%s</td>\n", $col_style[$j], $fval);
$tot_sent += $field;
}
else if ($j == 3) {
$fval = number_format($field, 2);
printf("\t<td class='%s'>%s</td>\n", $col_style[$j], $fval);
$tot_mb += $field;
}
else
print "\t<td class='".$col_style[$j]."'>$field</td>\n";
$j++;
}
print "</tr>\n";
}
$i++;
if (($i & 1) == 1)
print "<tr>\n";
else
print "<tr id='odd'>\n";
print "<td id='trline' class='no'>" . number_format($tot_sent, 0) .
"</td><td id='trline'> </td><td id='trline'> </td><td
id='trline' class='mb'>" . number_format($tot_mb, 2) . "</td></tr>\n";
print "</table>\n";
print "</td></tr></table>\n";
mysql_close($link);
?>
<div class="copy">
<p>
<a target="_blank" href="mailchart.php?D1=<? echo $id_option; ?>"><span
title="Click to view full size chart"><img class="chart" alt="Click to
view full size chart" src="mchartinc.php?D1=<? echo $id_option;
?>"></span></a><br>
</form>
<p>Copyright © 2006. Nigel Frankcom & Craig Morrison. All
rights reserved.</p>
</div>
</div>
</body>
</html>
<!---------- begin config.inc.php ---------->
<?
// define query titles
$id_text[1]="Group Total Sent & Received";
$id_text[2]="EU Total Sent & Received";
$id_text[3]="EU Total Sent";
$id_text[4]="EU Total Received";
$id_text[5]="EU Sent By User";
$id_text[6]="EU Received By User";
$id_text[7]="US Total Sent & Received";
$id_text[8]="US Total Sent";
$id_text[9]="US Total Received";
$id_text[10]="US Sent By User";
$id_text[11]="US Received By User";
$id_text[12]="All Domains";
// define view names
$id_view[1]="GroupTotal";
$id_view[2]="EUTotal";
$id_view[3]="EUAllSent";
$id_view[4]="EUAllRcvd";
$id_view[5]="EUSent";
$id_view[6]="EURcvd";
$id_view[7]="USTotal";
$id_view[8]="USAllSent";
$id_view[9]="USAllRcvd";
$id_view[10]="USSent";
$id_view[11]="USRcvd";
$id_view[12]="AllDomainsTotal";
// define column styles
$fc_col_styles['TOTAL'] = 'no';
$fc_col_styles['Total'] = 'no';
$fc_col_styles['SENT'] = 'no';
$fc_col_styles['Sent'] = 'no';
$fc_col_styles['RCVD'] = 'no';
$fc_col_styles['Rcvd'] = 'no';
$fc_col_styles['Month'] = 'mo';
$fc_col_styles['MONTH'] = 'mo';
$fc_col_styles['User'] = 'us';
$fc_col_styles['USER'] = 'us';
$fc_col_styles['MBytes'] = 'mb';
$fc_col_styles['MBYTES'] = 'mb';
// set default values
$id_text_count = 12;
$id_option = 1;
// determine what view we are querying
if ($_SERVER['REQUEST_METHOD'] == 'POST')
$id_option = $_POST['D1'];
else if ($_SERVER['REQUEST_METHOD'] == 'GET')
$id_option = $_GET['D1'];
//print_r($_POST);
if (($id_option == 0) || ($id_option > $id_text_count)) {$id_option = 1;}
$selectID = $id_view[$id_option];
?>
<!---------- begin mailchart.php ---------->
<?
include('./inc/config.inc.php');
include('charts/libchart/libchart.php');
$db="mailstats";
$link = mysql_connect(...);
if (! $link) die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM $selectID" ) or die("SELECT Error:
".mysql_error());
header("Content-Type: image/png");
$user_chart = 0;
$y = 400;
$x = 600;
$f = 10;
$logo_img = dirname(__FILE__) . '/images/stroud-logo-big.png';
if (($id_option == 5) || ($id_option == 6) || ($id_option == 10) ||
($id_option == 11) || ($id_option == 12)) {
$y = 1400;
$x = 400;
$f = 7;
$logo_img = dirname(__FILE__) . '/images/stroud-logo-small.png';
$user_chart = 1;
}
if ($id_option == 1)
$chart = new PieChart($x,$y,$f);
else
$chart = new HorizontalChart($x,$y,$f);
// mdata = array of field stuff
// 0 = total
// 1 = month
// 2 = user/group
// 3 = mbytes
while ($mdata = mysql_fetch_row($result)){
if ($user_chart)
$chart->addPoint(new Point($mdata[1] . " - " . $mdata[2], $mdata[0]));
else
$chart->addPoint(new Point(($id_option != 1) ? $mdata[1] : $mdata[1] .
" : " . $mdata[0], $mdata[0]));
}
$chart->setLogo($logo_img);
$chart->setTitle(str_replace("&", "&", $id_text[$id_option]));
$chart->render();
mysql_close($link);
?>
<!---------- begin mchartinc.php ---------->
<?
include('./inc/config.inc.php');
include('charts/libchart/libchart.php');
$db="mailstats";
$link = mysql_connect(...);
if (! $link) die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM $selectID" ) or die("SELECT Error:
".mysql_error());
header("HTTP/1.1 200 OK");
header("Cache-Control: no-cache");
header("Content-Type: image/png");
header("Content-Disposition: attachment; filename=stroudchart.png");
$user_chart = 0;
$y = 200;
$x = 300;
$f = 4;
$logo_img = dirname(__FILE__) . '/images/stroud-logo-small.png';
if (($id_option == 5) || ($id_option == 6) || ($id_option == 10) ||
($id_option == 11)) {
$y = 200;
$x = 300;
$f = 4;
$user_chart = 1;
}
if ($id_option == 1)
$chart = new PieChart($x,$y,$f);
else
$chart = new HorizontalChart($x,$y,$f);
// mdata = array of field stuff
// 0 = total
// 1 = month
// 2 = user/group
// 3 = mbytes
$i = 0;
while ($mdata = mysql_fetch_row($result)){
$chart->addPoint(new Point($mdata[1], $mdata[0]));
$i++;
if ($i > 8)
break;
}
$chart->setLogo($logo_img);
$chart->setTitle(str_replace("&", "&", $id_text[$id_option]));
$chart->render();
mysql_close($link);
?>
I have left *nothing* out, so now, if you or anyone else can please tell
me why the notice is thrown.
--
Craig Morrison
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
http://pse.2cah.com
Controlling pseudoephedrine purchases.
http://www.mtsprofessional.com/
A Win32 email server that works for You.