Hi, In the following code, only the first row from query1 displays along with the display stuff from query3. The problem: query1 refuses to recurse to the next and following rows.
It appears that the sub-queries in the main query cause the $row++; not to
work.
Is there some conditional that might it prompt it to do so?
I'm stumped - worked at variations for a few days. Any help, pointers,
suggestions most gratefully welcome!
<?php
include("dbc.php");
if (!$db){ $_SESSION['db'] = "select-thread"; session_write_close();
header("location: db.php");}
$query1 = "SELECT * FROM replies WHERE mid = '{$_SESSION['mid']}'";
$result1 = pg_exec($db, $query1);
if (!$result1) { exit;}
$numrows1 = pg_numrows($result1);
$row = 0;
do
{
$myrow = pg_fetch_array($result1, $row);
/* display stuff */
$query2 = "SELECT * FROM subs WHERE mid =
'{$_SESSION['mid']}' AND
rid = '{$myrow['rid']}'";
$result2 = pg_exec($db, $query2);
if (!$result2) { exit;}
$numrows2 = pg_numrows($result2);
$row = 0;
do
{
$myrow =
pg_fetch_array($result2, $row);
/* display stuff */
$row++;
}
while ($row < $numrows2);
$query3 = "SELECT * FROM subs where subsid =
'{$_SESSION['subsid']}'
AND rid = '{$myrow['rid']}' AND
responded = '1'";
$result3 = pg_exec($db, $query3);
if (!$result3) { exit;}
$numrows3 = pg_numrows($result3);
$row = 0;
do
{
$myrow = pg_fetch_array($result3,
$row);
/* display stuff */
$row++;
}
while ($row < $numrows3);....
$row++;
}
while ($row < $numrows1);
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

