Hi
Many thanks for your time Matt. I tried that method amongst a few
others, and couldn't seem to get it right. What I have eventually come
across is the function 'array-push' (bizarre!) to add a new array line
for each record (after it's been initially defined). It seems to work
for me, and hopefully it is the correct, standard way to do such a task.
$strCusts = array(array('id','name'));
/* setting up empty array for cust id and name */
if (mysql_num_rows($resCusts) > 0) {
$intCusts = mysql_num_rows($resCusts);
/* store the number of records retrieved */
while ($oRsCusts = mysql_fetch_array($resCusts)) {
array_push($strCusts,array($oRsCusts["id"],$oRsCusts["name"])); /* add
new array row */
}
}
Many thanks once again.
Gary
"Matt Matijevich" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
>
> select id, name from customer
> redim custarray(recordcount,2)
> i = 0
> while not eof
> custarray(i,0) = id;
> custarray(i,1) = name;
> i = i+1;
> movenext
> wend
>
>
> Not sure what kind of db you are using but I put this together using
> postgresql using the manual. So this is untested.
>
> $conn = pg_connect("host=localhost dbname=whatever");
> $result = pg_exec($conn, "select id, name from customer");
> $i = 0;
> while ($row = pg_fetch_array($result))
> {
> $custarray[$i][0] = $row["id"];
> $custarray[$i][1] = $row["name"];
> $i++;
> }
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php