I have mysql set up like this
MySQL
Table: gallery
+-------------+------------+
| galleryname | coverphoto |
+-------------+------------+
Table: multigalleries
+-------------+-----------+
| galleryname | galleries |
+-------------+-----------+
I am using a checkbox array from php to place galleries into multigalleries.galleries
like gallery1,gallery2,gallery3
. All of that works fine, the only thing i cant figure out is, when I pull the list of gallery.galleryname
and reference it with multigalleries.galleries
, how can i return a checked state if it exists in multigalleries.galleries
?
Any help would be greatly appreciated.
EDIT// ACTUAL CODE IM USING IF IT WILL HELP
$con = mysql_connect($host,$dbusername,$dbpassword);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($databasename, $con);
$query = "SELECT galleries.gallery, galleries.coverphoto, multigalleries.multigallery, multigalleries.galleries FROM galleries, multigalleries";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<div class="gallery" style="background-image:none">';
echo '<input type="checkbox" name="galleriesm[]" value="'.$line[gallery].'">'. $line[gallery].'';
echo '</div>';