Store an array in an array? PostgreSQL and PHP
Posted: Fri Oct 18, 2002 4:30 am
I am using PHP to access a PostgreSQL database for an online banking application. I am having some problems with arrays.
//assume database connectivity
$sql = "some SQL statement"
$result = pg_query ($dbconn, $sql);
$data = pg_fetch_row ($result);
$ans = Array ();
//in this while loop I want to put the rows that satisfied a condition into the array $ans
while ($data != false) {
if cond {
$ans[] = $data;
$data = pg_fetch_row ($result);
}
}
I am really not familiar with the array syntax and could not find any relevant examples. Can someone tell me how to store an array $data into another array $ans and later to retrieve the values? Further, is there a way to create the array $ans = Array () with a give array size like $size?
Thank you so much!!!
//assume database connectivity
$sql = "some SQL statement"
$result = pg_query ($dbconn, $sql);
$data = pg_fetch_row ($result);
$ans = Array ();
//in this while loop I want to put the rows that satisfied a condition into the array $ans
while ($data != false) {
if cond {
$ans[] = $data;
$data = pg_fetch_row ($result);
}
}
I am really not familiar with the array syntax and could not find any relevant examples. Can someone tell me how to store an array $data into another array $ans and later to retrieve the values? Further, is there a way to create the array $ans = Array () with a give array size like $size?
Thank you so much!!!