Page 1 of 1

fields and groups

Posted: Tue Mar 15, 2011 11:00 pm
by CoolAsCarlito
I have it displaying all the groups correctly however what I need it to do is display the correct fields that are enabled for each of those fields and not sure to complete this.

Code: Select all

<?php

session_start(); // Access the existing session

// Include the database page
require ('../../inc/dbconfig.php');

$defaultCharID = $_SESSION['defaultCharID'];

$styleIDQuery = "
    SELECT
        characters.styleID
    FROM
        characters
    WHERE
        characters.ID = '" . $defaultCharID . "'";
$styleIDResult = mysqli_query ( $dbc, $styleIDQuery ); // Run The Query
$row = mysqli_fetch_array( $styleIDResult, MYSQL_ASSOC );
$styleID = $row[ 'styleID' ];

$groupsQuery = "
    SELECT 
        groups.* 
    FROM 
        groups 
    WHERE 
        groups.styleID = '" . $styleID . "' AND groups.enabled = 0
    ORDER BY 
        groups.ID";
$groupsResult = mysqli_query ( $dbc, $groupsQuery ); // Run The Query


$fieldsQuery = "
    SELECT 
        fields.* 
    FROM 
        fields 
    WHERE 
        fields.styleID = '" . $styleID . "' AND fields.groupID = '" . $groupID . "' AND fields.enabled = 0";
$fieldsResult = mysqli_query ( $dbc, $fieldsQuery ); // Run The Query

?>

<script type="text/javascript">
$(document).ready(function() {

});
</script>

<!-- Title -->
<div id="title" class="b2">
	<h2>Character Management</h2>
	<!-- TitleActions -->
	<div id="titleActions">
		<!-- ListSearch -->
		<div class="listSearch actionBlock">
			<div class="search">
				<label for="search">Recherche</label>
				<input type="text" name="search" id="search" class="text" />
			</div>
			<div class="submit">
				<button type="submit" id="search-button" class="button"><strong><img src="img/icons/search_48.png" alt="comments" class="icon "/></strong></button>
			</div>
		</div>
		<!-- /ListSearch -->
	</div>
	<!-- /TitleActions -->
</div>
<!-- Title -->

<!-- Inner Content -->
<div id="innerContent">
	
    <form action="#" id="bioForm" >
        <?php 
            while ($row = mysqli_fetch_array($groupsResult, MYSQL_ASSOC)) {
                echo "<fieldset>
    		    <legend>'" . $row['groupName'] . "'</legend>";
                
                echo "</fieldset>";
            }  
        ?>
        <input type="submit" class="submit" name="submitMatchType" id="submitMatchType" title="Submit Match Type" value="Submit Match Type"/>
    </form>

</div>
<!-- /Inner Content -->

Re: fields and groups

Posted: Wed Mar 16, 2011 1:13 pm
by Jonah Bron
Not really sure what you're asking. Could you elaborate?

Re: fields and groups

Posted: Wed Mar 16, 2011 5:52 pm
by danwguy
I think I know what you are saying, you are displaying everything but the $fieldsResult you need to do the same thing you did for the $groupsResult which is...

Code: Select all

<?php 
            while ($row = mysqli_fetch_array($groupsResult, MYSQL_ASSOC)) {
                echo "<fieldset>
                    <legend>'" . $row['groupName'] . "'</legend>";
                
                echo "</fieldset>";
            }  
        ?>
only do it for the $fieldsResult variable and that will display the fieldsresult