I have to Data Tables on the same page, based on different queries
from different tables.
Works perfectly fine in FF, but in IE8 tables just wouldn't display.

Here's an error code:
/////////////////////////////////////////////////////////////////////////////////
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/
4.0; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729)
Timestamp: Thu, 30 Dec 2010 23:15:28 UTC


Message: 'this.A[...]' is null or not an object
Line: 257
Char: 261
Code: 0
URI: 
http://www.google.com/uds/api/visualization/1.0/268b3e7a1f6f100ef52c4fbabb0d0f07/default,table.I.js
//////////////////////////////////////////////////////////////////////////////////


Here is the full code for php page sans connection information.
I thought the problem was calling drawVisualization1 and
drawVisualization separately using google.setOnLoadCallback, but
combining both into one function did not help.

Can someone point out where the error is? Again, this works fine in
Firefox. Json data pulls correctly and is formatted correctly.



<?php


if (isset($_GET['searchpin'])){
$searchpin = $_GET['searchpin'];
}elseif (isset($_POST['searchpin'])){
$searchpin = trim($_POST['searchpin']);
$_SESSION["dates"]["searchpin"] = $searchpin;
}elseif((isset($_SESSION['dates']))&&(isset($_SESSION["dates"]
["searchpin"]))){
$searchpin = $_SESSION["dates"]["searchpin"];
$_POST['searchpin'] = $_SESSION["dates"]["searchpin"];
}else{
$searchpin=NULL;
}


if (isset($_POST['submitted2'])){
$trimmed = array_map('trim', $_POST);

if (($trimmed['from_month']) && ($trimmed['from_day']) &&
($trimmed['from_year']) && ($trimmed['to_month']) &&
($trimmed['to_day']) && ($trimmed['to_year'])){  ##if both dates
enetered
$from_month = $trimmed['from_month'];
$from_day = $trimmed['from_day'];
$from_year = $trimmed['from_year'];
#$period .= " visits from $from_month/$from_year";
$date_from = "$from_year-$from_month-$from_day";

$to_month = $trimmed['to_month'];
$to_year = $trimmed['to_year'];
$to_day = $trimmed['to_day'];
$date_to = "$to_year-$to_month-$to_day";
#$period .= " up to $to_month/$to_year";

$_SESSION["dates"]["to_month"] = $to_month;
$_SESSION["dates"]["to_day"] = $to_day;
$_SESSION["dates"]["to_year"] = $to_year;
$_SESSION["dates"]["from_month"] = $from_month;
$_SESSION["dates"]["from_day"] = $from_day;
$_SESSION["dates"]["from_year"] = $from_year;
$_SESSION["dates"]["date_to"] = $date_to;
$_SESSION["dates"]["date_from"] = $date_from;

}elseif(($trimmed['from_month']) && ($trimmed['from_day']) &&
($trimmed['from_year']) && (!($trimmed['to_month']) OR !
($trimmed['to_year']))){  ## if only From dates enetered
$from_month = $trimmed['from_month'];
$from_day = $trimmed['from_day'];
$from_year = $trimmed['from_year'];
#$period .= " visits from $from_month/$from_year to today";
$date_from = "$from_year-$from_month-$from_day";
$date_to = date("Y-m-d");
$to_month = date('m');
$to_day = date('d');
$to_year = date('Y');

$_SESSION["dates"]["to_month"] = $to_month;
$_SESSION["dates"]["to_day"] = $to_day;
$_SESSION["dates"]["to_year"] = $to_year;
$_SESSION["dates"]["from_month"] = $from_month;
$_SESSION["dates"]["from_day"] = $from_day;
$_SESSION["dates"]["from_year"] = $from_year;
$_SESSION["dates"]["date_to"] = $date_to;
$_SESSION["dates"]["date_from"] = $date_from;

}elseif((!($trimmed['from_month']) OR !($trimmed['from_year'])) &&
($trimmed['to_month']) && ($trimmed['to_year'])){ ## if only TO dates
entered

if((int)date('m')<>1){
$from_month = date('m')-1;
$from_year = date('Y');
}else{
$from_month = 12;
$from_year = date('Y')-1;
}
$from_day = date('d');
$date_from = date($from_year."-".$from_month."-d");
#$from_year = '2009';
#$from_month = '01';
#$from_day  = '01';
#$date_from = "$from_year-01-01";
#$period .= "all visits ";

$to_month = $trimmed['to_month'];
$to_day = $trimmed['to_day'];
$to_year = $trimmed['to_year'];

$date_to = "$to_year-$to_month-$to_day";
#$period .= " up to $to_month/$to_year";

$_SESSION["dates"]["to_month"] = $to_month;
$_SESSION["dates"]["to_day"] = $to_day;
$_SESSION["dates"]["to_year"] = $to_year;
$_SESSION["dates"]["from_month"] = $from_month;
$_SESSION["dates"]["from_day"] = $from_day;
$_SESSION["dates"]["from_year"] = $from_year;
$_SESSION["dates"]["date_to"] = $date_to;
$_SESSION["dates"]["date_from"] = $date_from;
}else{ ## no dates entered
if((int)date('m')<>1){
$from_month = date('m')-1;
$from_year = date('Y');
}else{
$from_month = 12;
$from_year = date('Y')-1;
}
$from_day = date('d');
$date_from = date($from_year."-".$from_month."-d");

#$from_month = '01';
#$from_day  = '01';
#$from_year = '2009';
#$date_from = "$from_year-01-01";
#$period .= "all visits.";

$date_to = date("Y-m-d");
$to_month = date('m');
$to_day = date('d');
$to_year = date('Y');

$_SESSION["dates"]["to_month"] = $to_month;
$_SESSION["dates"]["to_day"] = $to_day;
$_SESSION["dates"]["to_year"] = $to_year;
$_SESSION["dates"]["from_month"] = $from_month;
$_SESSION["dates"]["from_day"] = $from_day;
$_SESSION["dates"]["from_year"] = $from_year;
$_SESSION["dates"]["date_to"] = $date_to;
$_SESSION["dates"]["date_from"] = $date_from;
}

}elseif(isset($_SESSION['dates'])){ ## there is session data
$date_from = $_SESSION["dates"]["date_from"];
$date_to = $_SESSION["dates"]["date_to"];

$_POST['from_month'] = $_SESSION["dates"]["from_month"];
$_POST['from_day'] = $_SESSION["dates"]["from_day"];
$_POST['from_year'] = $_SESSION["dates"]["from_year"];

$_POST['to_month'] = $_SESSION["dates"]["to_month"];
$_POST['to_day'] = $_SESSION["dates"]["to_day"];
$_POST['to_year'] = $_SESSION["dates"]["to_year"];
}else{ ## form was not submitted and there is no session data

if((int)date('m')<>1){
$from_month = date('m')-1;
$from_year = date('Y');
}else{
$from_month = 12;
$from_year = date('Y')-1;
}
$from_day = date('d');
$date_from = date($from_year."-".$from_month."-d");
#$from_month = '01';
#$from_day  = '01';
#$from_year = '2009';
#$date_from = "$from_year-01-01";
$date_to = date("Y-m-d");
$to_month = date('m');
$to_day = date('d');
$to_year = date('Y');

$year_start = 2000;
$year_end = 2020;
$_SESSION["dates"]["to_month"] = $to_month;
$_SESSION["dates"]["to_day"] = $to_day;
$_SESSION["dates"]["to_year"] = $to_year;
$_SESSION["dates"]["from_month"] = $from_month;
$_SESSION["dates"]["from_day"] = $from_day;
$_SESSION["dates"]["from_year"] = $from_year;
$_SESSION["dates"]["date_to"] = $date_to;
$_SESSION["dates"]["date_from"] = $date_from;
}
?>

<script type='text/javascript' src='http://www.google.com/jsapi'></
script>
<script type='text/javascript'>
google.load('visualization', '1', {packages: ['table']});
</script>
<style>
.google-visualization-table-div-page .goog-custom-button-inner-box{
padding-top: 1px;
padding-right: 5px;
padding-bottom: 1px;
padding-left: 5px;
}
.goog-custom-button-inner-box{
margin-top: 0pt;
margin-right: 0px;
margin-bottom: 0pt;
margin-left: 0px;
}
</style>

<h1>View VFC Vaccine Usage and Inventory Report</h1>


<form action="" method="post" name="search_cond">
Search orders by PIN: &nbsp;&nbsp;<input type="text" size="6"
maxlength="6" name="searchpin" value="<?php if
(isset($_POST['searchpin'])) {echo $_POST['searchpin'];} ?
>">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit_pin" id ="submit_pin" class="submit"
value="Search by PIN">
<input type="hidden" name="submitted" value="TRUE">
</form>
<br>

<form name="daterange" action="" method="post">
Please enter month, day and year if you want to see report for certain
dates.<br>
If you want to see report for all records, leave fields blank.
<br>
>From (month/day/year): &nbsp;
<select name="from_month">
<option value=""> &nbsp;</option>
<?php
foreach($months_full as $key =>$value){
echo "<option value=\"$key\"";
if (isset($_POST['from_month']) && ($_POST['from_month']==$key)) echo
' selected="selected"';
echo ">$value</option>\n";
}
?>
</select>
<select name="from_day">
<option value=""> &nbsp;</option>
<?php
foreach($days as $key =>$value){
echo "<option value=\"$key\"";
if (isset($_POST['from_day']) && ($_POST['from_day']==$key)) echo '
selected="selected"';
echo ">$value</option>\n";
}
?>
</select>
<input type="text" name="from_year" size="4" maxlength="4" value="<?
php if (isset($_POST['from_year'])) {echo $_POST['from_year'];} ?>">
&nbsp;&nbsp;

To (month/day/year): &nbsp;
<select name="to_month">
<option value=""> &nbsp;</option>
<?php
foreach($months_full as $key =>$value){
echo "<option value=\"$key\"";
if (isset($_POST['to_month']) && ($_POST['to_month']==$key)) echo '
selected="selected"';
echo ">$value</option>\n";
}
?>
</select>
<select name="to_day">
<option value=""> &nbsp;</option>
<?php
foreach($days as $key =>$value){
echo "<option value=\"$key\"";
if (isset($_POST['to_day']) && ($_POST['to_day']==$key)) echo '
selected="selected"';
echo ">$value</option>\n";
}
?>
</select>
<input type="text" name="to_year" size="4" maxlength="4" value="<?php
if (isset($_POST['to_year'])) {echo $_POST['to_year'];} ?>">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" class="submit" value="Set Date
Range"><br>
<input type="hidden" name="submitted2" value="TRUE">

</form>
<script type="text/javascript">
    var visualization1;
    var data1;
    var options1 = {'showRowNumber': true};
        var visualization;
    var data;
    var options = {'showRowNumber': true};
</script>

<script type="text/javascript">

    function drawVisualization1() {
      // Create and populate the data table.
      var dataAsJson1 =
      {cols:[
                {id:'A',label:'PIN',type:'string'},
                {id:'B',label:'Date Reported',type:'number'},
        {id:'C',label:'Dtap usage',type:'number'},
                {id:'D',label:'Dtap\n/IPV usage',type:'number'},
                {id:'E',label:'Dtap/\nHepatitis B/IPV usage',type:'number'},
                {id:'F',label:'Dtap/\nIPV/Hib usage',type:'number'},
                {id:'G',label:'Hepatitis A usage',type:'number'},
                {id:'H',label:'Hepatitis B usage',type:'number'},
                {id:'I',label:'Hib usage',type:'number'},
                {id:'G',label:'HPV usage',type:'number'},
                {id:'K',label:'IPV usage',type:'number'},
                {id:'L',label:'Meningo\ncoccal Conjugate usage',type:'number'},
                {id:'M',label:'Pneumo\ncoccal Conjugate usage',type:'number'},
                {id:'N',label:'Rotavirus usage',type:'number'},
                {id:'O',label:'Td usage',type:'number'},
                {id:'P',label:'Tdap usage',type:'number'},
                {id:'Q',label:'Varicella usage',type:'number'},
                {id:'R',label:'MMR usage',type:'string'},

                //,{id:'U',label:'Edit',type:'string'}
                ],
      rows:[


<?php

if ($searchpin<>NULL){
$q = "SELECT count(usage_id) FROM vfc_vaccine_usage WHERE
pin='$searchpin' AND  date>='$date_from' AND date<='$date_to'";
}else{
$q = "SELECT count(usage_id) FROM vfc_vaccine_usage WHERE
date>='$date_from' AND date<='$date_to'";
}
$r = mysqli_query ($dbc, $q) or die("Error: ".mysqli_error($dbc));
$row = mysqli_fetch_array ($r, MYSQLI_NUM);

$records = $row[0];

if ($searchpin<>NULL){
$q1 = "SELECT *,  DATE_FORMAT(date, '%Y%m%d') AS date_report FROM
vfc_vaccine_usage  WHERE pin='$searchpin' AND  date>='$date_from' AND
date<='$date_to' ORDER BY usage_id DESC";
}else{
$q1 = "SELECT *,  DATE_FORMAT(date, '%Y%m%d') AS date_report FROM
vfc_vaccine_usage WHERE  date>='$date_from' AND date<='$date_to' ORDER
BY usage_id DESC";
}
$r1= mysqli_query ($dbc, $q1) or die("Error: ".mysqli_error($dbc));

$i=0;
while($row1 = mysqli_fetch_array($r1)){$i++;
$usage_id = $row1['usage_id'];
$pin = $row1['pin'];
$date_report = $row1['date_report'];

$Dtap = $row1['Dtap'];
$Dtap_IPV = $row1['Dtap_IPV'];
$Dtap_HepB_IPV = $row1['Dtap_HepB_IPV'];
$Dtap_IPV_Hib = $row1['Dtap_IPV_Hib'];

$HepA = $row1['HepA'];
$HepB = $row1['HepB'];
$Hib = $row1['Hib'];
$HPV = $row1['HPV'];
$IPV = $row1['IPV'];

$M_Conjugate = $row1['M_Conjugate'];
$P_Conjugate = $row1['P_Conjugate'];

$Rotavirus = $row1['Rotavirus'];
$Td = $row1['Td'];
$Tdap = $row1['Tdap'];
$Varicella = $row1['Varicella'];
$MMR = $row1['MMR'];


  print"{c:[{v:'$pin'},{v:$date_report},{v:$Dtap},{v:$Dtap_IPV},{v:
$Dtap_HepB_IPV},{v:$Dtap_IPV_Hib},{v:$HepA},{v:$HepB},{v:$Hib},{v:
$HPV},{v:$IPV},{v:$M_Conjugate},{v:$P_Conjugate},{v:$Rotavirus},{v:
$Td},{v:$Tdap},{v:$Varicella},{v:$MMR}]}";
  if ($i<$records){
  print",\n";
        }else{
        print "]};";
        }

}

          ?>

      data1 = new google.visualization.DataTable(dataAsJson1, '0.6');

      // Set paging configuration options
      // Note: these options are changed by the UI controls in the
example.
          var cssClassNames1 = {'headerRow': 'smallbold', 'tableCell':
'smallcell'};
      options1['page'] = 'enable';
          options1['allowHtml'] = true;
          options1['width'] = '100%';
          options1['cssClassNames'] = cssClassNames1;
          options1['pageSize'] = 20;
          options1['pagingSymbols'] = {prev: 'prev', next: 'next'};
      options1['pagingButtonsConfiguration'] = 'auto';

      // Create and draw the visualization.
      visualization1 = new
google.visualization.Table(document.getElementById('table'));
      draw1();
    }

    function draw1() {
      visualization1.draw(data1, options1);
    }

    //google.setOnLoadCallback(drawVisualization1);

    // sets the number of pages according to the user selection.
    function setNumberOfPages1(value) {
      if (value) {
        options1['pageSize'] = parseInt(value, 10);
        options1['page'] = 'enable';
      } else {
        options1['pageSize'] = null;
        options1['page'] = null;
      }
      draw1();
    }


    // Sets custom paging symbols "Prev"/"Next"
    function setCustomPagingButtons1(toSet) {
      options1['pagingSymbols'] = toSet ? {next: 'next', prev:
'prev'} : null;
      draw1();
    }

    function setPagingButtonsConfiguration1(value) {
      options1['pagingButtonsConfiguration'] = value;
      draw1();
    }

    </script>



<script type="text/javascript">

    function drawVisualization() {
      // Create and populate the data table.
      var dataAsJson =
      {cols:[
                {id:'A',label:'PIN',type:'string'},
                {id:'B',label:'Inventory Date',type:'number'},
        {id:'C',label:'NDC',type:'string'},
                {id:'D',label:'Lot Number',type:'string'},
                {id:'E',label:'Quantity',type:'number'},
                {id:'F',label:'Expiration Date',type:'number'},
                {id:'G',label:'Version',type:'string'},

                ],
      rows:[


<?php

if ($searchpin<>NULL){
$q_vac = "SELECT *, DATE_FORMAT(date_updated, '%Y%m%d') AS
date_updated FROM  vfc_vaccine_inventory WHERE pin='$searchpin' AND
date_updated>='$date_from' AND date_updated<='$date_to' ORDER BY pin
ASC";
}else{
$q_vac = "SELECT *, DATE_FORMAT(date_updated, '%Y%m%d') AS
date_updated FROM  vfc_vaccine_inventory WHERE
date_updated>='$date_from' AND date_updated<='$date_to' ORDER BY pin
ASC";
}
$r_vac= mysqli_query ($dbc, $q_vac) or die("Error:
".mysqli_error($dbc));
$num_rows_proc = mysqli_num_rows($r_vac);
$x=0;
while($row_vac = mysqli_fetch_array($r_vac)){ $x++;
$inv_pin =$row_vac['pin'];
$date_updated = $row_vac['date_updated'];
$ndc =$row_vac['ndc'];

$q_vac1 = "SELECT * FROM  vfc_vaccines WHERE ndc='$ndc'  ORDER BY
vaccine_id ASC";
$r_vac1= mysqli_query ($dbc, $q_vac1) or die("Error:
".mysqli_error($dbc));
while($row_vac1 = mysqli_fetch_array($r_vac1)){
$vac_name =$row_vac1['vac_name'];
$vac_pack = $row_vac1['vac_pack'];
$vac_fullname = $vac_name.' '.$vac_pack;
}

$ndc = "<span title=\"$vac_fullname\">$ndc</span>";

$lot =$row_vac['lot'];
$qty =$row_vac['qty'];
$exp_date =$row_vac['exp_date'];
$version="1.0";

  print"{c:[{v:'$inv_pin'},{v:$date_updated},{v:'$ndc'},{v:'$lot'},{v:
$qty},{v:$exp_date},{v:'$version'}]}";
  if ((1<$num_rows_proc) && ($x<$num_rows_proc)){
  print",\n";
        }else{
        print "]};";
}
} ##End of WHILE loop
?>

      data = new google.visualization.DataTable(dataAsJson, '0.6');

      // Set paging configuration options
      // Note: these options are changed by the UI controls in the
example.
          var cssClassNames = {'headerRow': 'smallbold', 'tableCell':
'smallcell'};
      options['page'] = 'enable';
          options['allowHtml'] = true;
          options['width'] = '100%';
          options['cssClassNames'] = cssClassNames;
          options['pageSize'] = 20;
          options['pagingSymbols'] = {prev: 'prev', next: 'next'};
      options['pagingButtonsConfiguration'] = 'auto';

      // Create and draw the visualization.
      visualization = new
google.visualization.Table(document.getElementById('table2'));
      draw();
    }

    function draw() {
      visualization.draw(data, options);
    }

    //google.setOnLoadCallback(drawVisualization);

    // sets the number of pages according to the user selection.

    function setNumberOfPages(value) {
      if (value) {
        options['pageSize'] = parseInt(value, 10);
        options['page'] = 'enable';
      } else {
        options['pageSize'] = null;
        options['page'] = null;
      }
      draw();
    }

    // Sets custom paging symbols "Prev"/"Next"
    function setCustomPagingButtons(toSet) {
      options['pagingSymbols'] = toSet ? {next: 'next', prev:
'prev'} : null;
      draw();
    }

    function setPagingButtonsConfiguration(value) {
      options['pagingButtonsConfiguration'] = value;
      draw();
    }

    </script>



<h3>Usage Report</h3>
<div style="width: 92%;">
    <div style="color: #ededed; font-size: 11px; padding: 5px; border:
1px solid gray; background-color: #8399b1; padding-bottom: 10px;">
        <form action="" name="form1" id="form1">
        <span style="font-size: 12px;">Number of rows per page:</span>
        <select style="font-size: 12px"
onchange="setNumberOfPages1(this.value)">
          <option value="">No paging</option>
          <option value="10">10</option>
          <option selected="selected" value="20">20</option>
          <option value="30">30</option>
          <option  value="40">40</option>
          </select>
      </form>
      </div>
    <div id="table" class="maintable"></div>
</div>


<?php

if ($searchpin<>NULL){//pin specified
$cond="?searchpin=$searchpin";

if (($date_to<>NULL) &&($date_from)){
$cond .="&date_to=$date_to&date_from=$date_from";
}elseif (($date_from<>NULL)&&($date_from==NULL)){
$cond .="&date_from=$date_from";
}elseif (($date_from==NULL)&&($date_from<>NULL)){
$cond .="&date_to=$date_to";
}
}else{//no pin specified
$cond=NULL;

if (($date_to<>NULL) &&($date_from)){
$cond .="?date_to=$date_to&date_from=$date_from";
}elseif (($date_from<>NULL)&&($date_from==NULL)){
$cond .="?date_from=$date_from";
}elseif (($date_from==NULL)&&($date_from<>NULL)){
$cond .="?date_to=$date_to";
}
}


echo"<a href='download_usage.php$cond'>Download Excel Version of Usage
Report <img src='images/excel.gif' alt='Download Excel Version'></
a><br>\n";

echo "<br><br>\n";

//print"<div><br>Total number of usage reposrts: $records<br></
div><br><br>\n";

?>

<h3>Current Inventory Report</h3>
<div style="width: 92%;">
    <div style="color: #ededed; font-size: 11px; padding: 5px; border:
1px solid gray; background-color: seagreen; padding-bottom: 10px;">
        <form action="" name="form2" id="form2">
        <span style="font-size: 12px;">Number of rows per page:</span>
        <select style="font-size: 12px"
onchange="setNumberOfPages(this.value)">
          <option value="">No paging</option>
          <option value="10">10</option>
          <option selected="selected" value="20">20</option>
          <option value="30">30</option>
          <option  value="40">40</option>
          </select>
      </form>
      </div>
    <div id="table2" class="maintable"></div>
</div>


<?php
echo"<a href='download_inventory.php$cond'>Download Excel Version of
Inventory Report <img src='images/excel.gif' alt='Download Excel
Version'></a>\n";
?>
<script type="text/javascript">



google.setOnLoadCallback(start);

function start() {
drawVisualization1();
drawVisualization();
}
//google.setOnLoadCallback(drawVisualization1);
//google.setOnLoadCallback(drawVisualization);
//window.onload.setOnLoadCallback(drawVisualization);
</script>

<?php
mysqli_free_result($r_vac);
mysqli_free_result($r1);
mysqli_free_result($r);
mysqli_close($dbc);
include('includes/footer.html');
?>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to