2D Array problem.
Posted: Wed Oct 10, 2007 3:15 am
feyd | Please use
All I got in the $arr2 is the last record of the $q1. Is there something I misunderstood the use of array in the php? What I want is to get the every record in the array and loop thr' the array...
Why there is only one records in the array?
Thanks.
Dave
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi guys,
I got something like this:Code: Select all
...
$q1 = "select ... ";
$r1 = $conn->dbExecute($q1);
$cnt = 0;
while ($rs1=mssql_fetch_row($r1)) {
$arr2 = array($cnt => array($rs1[0],$rs1[1],$rs1[2],$rs1[3],$rs1[4],$rs1[5],$rs1[6],$rs1[7],$rs1[8],$rs1[9], ));
$cnt++;
}
$cnt1 = 0;
while (count($arr2) > $cnt1) { // foreach {... } or what ever
...
}All I got in the $arr2 is the last record of the $q1. Is there something I misunderstood the use of array in the php? What I want is to get the every record in the array and loop thr' the array...
Why there is only one records in the array?
Thanks.
Dave
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]