BarneyJoe Posted December 6, 2006 Share Posted December 6, 2006 What it is, is...I have a table photos, and a table keywords, whereby keywords can be attached to each photo, using a table photokeywords.This works fine when adding the keywords, using a page of checkboxes for each keyword.I'm just working on a page where people can edit the list of keywords for any given photo.I think it's almost working, but I'm still missing something. At the moment only the first matching checkbox is appearing as checked.The code is currently :[code]<?php require_once('Connections/Photolibrary.php'); ?><?php$colname_Keyword_Match = "1";if (isset($_GET['Photo_ID'])) { $colname_Keyword_Match = (get_magic_quotes_gpc()) ? $_GET['Photo_ID'] : addslashes($_GET['Photo_ID']);}mysql_select_db($database_Photolibrary, $Photolibrary);$query_Keyword_Match = sprintf("SELECT * FROM photokeywords WHERE Photo_ID = %s", $colname_Keyword_Match);$Keyword_Match = mysql_query($query_Keyword_Match, $Photolibrary) or die(mysql_error());$row_Keyword_Match = mysql_fetch_assoc($Keyword_Match);$totalRows_Keyword_Match = mysql_num_rows($Keyword_Match);$Photo_ID = intval($_GET['Photo_ID']);?>[/code]And then for each checkbox :[code]<input <?php if (!(strcmp($row_Keyword_Match['Keyword_ID'],2))) {echo "checked";} ?> name="ckbox[2]" type="checkbox" class="tickbox2" id="ckbox[2]">etc[/code]What am I missing?Cheers,Iain Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.