Re: Code check please
| From: | CPT John W. Holmes | Date: | Wed, 17 Sep 2003 19:02:05 +0000 |
| Subject: | Re: Code check please | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162907@lists.php.net to get a copy of this message | ||
From: "James Johnson" <james@primedna.net>
> Can anyone see why this code isn't working....
>
> $SID = $_SESSION['svUserID'];
> $AdID = $_GET['AdID'];
>
> // get the campuses assigned
> $qCampusID = "SELECT inst_id FROM ads_campuses WHERE ad_id = $AdID";
You say down below that this query only selects one row...
> $CampusIDList = mysql_query($qCampusID, $CCB) or die(mysql_error());
> $row_CampusIDList = mysql_fetch_assoc($CampusIDList);
and this mysql_fetch_assoc() call will return that one row into
$row_CampusIDList.
> //var_dump($row_CampusIDList);
>
> $tmp = array();
> while( $rowData = mysql_fetch_array( $CampusIDList )) {
This while will never execute as there are no more rows to select.
> //print("ROW Data $rowData");
> if(!in_array($rowData['inst_id'],$tmp)){
> $tmp[] = $rowData['inst_id'];
> }
> }
> //var_dump($tmp);
> $cidList = implode( ',', $tmp );
> //var_dump($cidList);
>
> If I do a var_dump($row_CampusIDList); I get a value, so I know there's
data
> to work with. But if I do a var_dump($tmp) and var_dump($cidList), they're
> both empty.
>
> This particular value query only has 1 inst_id of 100. Other queries with
> one value (99,45, etc) will work.
---John Holmes...