Hi
The recordset can return any combination of 1, 2 and 3, thats why I was thinking of an array,
i.e.
/////example
<sql>
SELECT postto.location_id
FROM postto
WHERE postto.listing_id=1384</sql>
item number 1384 can return 1,2,3
1 alone
2 alone
3 alone
or any combination of the 3, the only rules I have created for the recordset is that the user must select 1 of the 3 choices.
////// end example
So what I want to do is put whatever results the above query returns into an array to check the checkbox, with 1 query alone not 3 individual queries.
I am using Dreamweaver 8 to do this and it will allow you to dynamically check a checkbox if a value is present in a variable, (1, 2 or 3 in this case) but not if a value appears in an array, so I will have to manually create the array of results.
The Actual recordset created by Dreamweaver is this:
$item_alllocations = "-1";
if (isset($_SESSION['listingid'])) {
$item_alllocations = (get_magic_quotes_gpc()) ? $_SESSION['listingid'] : addslashes($_SESSION['listingid']);
}
mysql_select_db($database_localhost, $localhost);
$query_alllocations = sprintf("SELECT postto.location_id FROM postto WHERE postto.listing_id=%s", GetSQLValueString($item_alllocations, "int"));
$alllocations = mysql_query($query_alllocations, $localhost) or die(mysql_error());
$row_alllocations = mysql_fetch_assoc($alllocations);
$totalRows_alllocations = mysql_num_rows($alllocations);
and then the repeat region is:
<?php do { ?>
<?php echo $row_alllocations['location_id']; ?>
<?php } while ($row_alllocations = mysql_fetch_assoc($alllocations)); ?>
This returns 1 2 3 which means that the listing will allow delivery to UK, Europe and Worldwide, but how do I check the checkboxes with the results from one query?
David
|