Weird Scenario - PHP/MSAccess
So, I've got perhaps not the most normal scenario in the world. I'm using PHP interface and Microsoft Access as my Database.
Luckily PHP has ODBC compatibility with MSAccess, so that's not a problem, but I just wanted to preface with that.
Basically, I'm looking to draw data from a multi-join query, and stick it into the Grid.
It is not working.
Here's my code:
[CODE]
<SCRIPT>
var myData = new Array;
<?
$num_rows = 0;
$query = odbc_exec($odbc, "SELECT ...");
while($row = odbc_fetch_array($query))
{ ?>
myData.push('["<?=$row['field1']?>", "<?=$row['field2']?>", "<?=$row['field3']?>"]');
$num_rows++;
<? }
?>
var obj = new Active.Controls.Grid;
obj.setProperty("column/count", 3);
obj.setProperty("row/count", <?=$num_rows?>);
obj.setProperty("data/text", function(i,j){return myData[i][j]});
document.write(obj);
</SCRIPT>
[/CODE]
On the output, I get a grid with the proper number of rows and columns, but all the fields are 'undefined'.
What am I doing wrong? I have a feeling it has something to do with my multidimensional array 'myData', because when I just have the line say: return myData[i]
it returns the proper data, but it doesn't split the array into each cell (if that made any sense...).
Any help would be truly appreciated
Luckily PHP has ODBC compatibility with MSAccess, so that's not a problem, but I just wanted to preface with that.
Basically, I'm looking to draw data from a multi-join query, and stick it into the Grid.
It is not working.
Here's my code:
[CODE]
<SCRIPT>
var myData = new Array;
<?
$num_rows = 0;
$query = odbc_exec($odbc, "SELECT ...");
while($row = odbc_fetch_array($query))
{ ?>
myData.push('["<?=$row['field1']?>", "<?=$row['field2']?>", "<?=$row['field3']?>"]');
$num_rows++;
<? }
?>
var obj = new Active.Controls.Grid;
obj.setProperty("column/count", 3);
obj.setProperty("row/count", <?=$num_rows?>);
obj.setProperty("data/text", function(i,j){return myData[i][j]});
document.write(obj);
</SCRIPT>
[/CODE]
On the output, I get a grid with the proper number of rows and columns, but all the fields are 'undefined'.
What am I doing wrong? I have a feeling it has something to do with my multidimensional array 'myData', because when I just have the line say: return myData[i]
it returns the proper data, but it doesn't split the array into each cell (if that made any sense...).
Any help would be truly appreciated
Tim Claason
May 20,