This is on the page -
<tr>
<td><?php echo $row_rsDistricts['distName'];
?></td>
<td align="center"><select name="distDisplay"
size="1"
id="distDisplay">
<option value="0"<?php echo
!$row_rsDistricts['distDisplay']?' selected="selected"':''
?>>NO</option>
<option value="1"<?php echo
$row_rsDistricts['distDisplay']?' selected="selected"':''
?>>YES</option>
</select>
<input name="distRecNum" type="hidden" id="distRecNum"
value="<?php echo $row_rsDistricts['distRecNum']; ?>"
/></td>
</tr>
And I have this after applying the SB -
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" .
htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) &&
($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE cma_districts SET
distDisplay=%s WHERE
distRecNum=%s",
GetSQLValueString($_POST['distDisplay'], "int"),
GetSQLValueString($_POST['distRecNum'], "int"));
mysql_select_db($database_cmaConn, $cmaConn);
$Result1 = mysql_query($updateSQL, $cmaConn) or
die(mysql_error());
}
and I'm changing it to this -
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" .
htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($_POST['distDisplay']) &&
is_array($_POST['distDisplay'])) {
$toggle = implode(',', $_POST['distDisplay']);
}
else {
$toggle = NULL;
}
if ((isset($_POST["MM_update"])) &&
($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE cma_districts SET
distDisplay=%s WHERE
distRecNum=%s",
GetSQLValueString($_POST['distDisplay'], "int"),
GetSQLValueString($_POST['distRecNum'], "int"));
mysql_select_db($database_cmaConn, $cmaConn);
$Result1 = mysql_query($updateSQL, $cmaConn) or
die(mysql_error());
}
How would I adjust the SQL under these conditions?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"David Powers" <david@example.com> wrote in message
news:esgqi9$l3m$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> This is something I want the client to be able to
do, and although I said
>> to all what I meant was that all records would be
candidates for the
>> change but maybe only 20 of them would actually
change. What I'm trying
>> to avoid is the true->false, then update, and
repeat thing.
>
> Come on, Murray, make up your mind.
>
> Without knowing the full details of what you (or the
client) actually
> want, it's difficult to give an optimal answer. However,
it's relatively
> simple to do what you want.
>
> 1. Create a recordset of the target records.
> 2. Create a single-row table in a form. Inside the
single row, put a
> checkbox with the name toggle[] and set its value to the
primary ID of the
> record. Also display something that the client can
recognize the record
> by.
> 3. Apply a repeat region to the row, so that all records
are displayed.
> 4. Add a submit button to the form.
> 5. Apply an update record server behavior. It doesn't
really matter what
> you update, because you then need to dive into code view
to edit it.
> 6. Edit the update record server behavior so that it
includes the
> following:
>
> if (isset($_POST['toggle']) &&
is_array($_POST['toggle'])) {
> $toggle = implode(',', $_POST['toggle']);
> }
> else {
> $toggle = NULL;
> }
>
> 7. Set the update SQL to this:
> $sql = "UPDATE myTable SET column = 'false'
> WHERE primary_key IN ($toggle)";
>
> --
> David Powers, Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of
ED)
> Author, "PHP Solutions" (friends of ED)
>
http://foundationphp.com/