Boa tarde galera, acontece o seguinte a agenda não ta ficando ordenada em ordem crescente , alguém pode ajudar como ? na consulta do banco de dados aparece em ordem mas na hora de colocar no layout não vai fica aparecendo mês de setembro de vez o mês de abril
<?php
if (!isset($_GET['id'])) {
$validaRes = false;
$acao = "CADASTRAR";
}
else {
$acao = "ATUALIZAR";
$validaRes = true;
$sqlVideo = mysql_query("SELECT id , ano , mes, dia, evento, local, link, status FROM agenda WHERE id =" . $_GET['mes']);
$resVideo = mysql_fetch_object($sqlVideo);
}
?>
<form method="post" action="" enctype="multipart/form-data">
<fieldset style="">
<div style="clear: both; font-size: 12px; ">
<?php
if ($validaRes == true) {
?>
<div style="width: 80px; float: left; margin-right: 20px">
<label for="id" style="padding-bottom: 5px; text-align: center">ID</label>
<input type="text" name="id" id="id" class="text ui-widget-content ui-corner-all" value="<?php echo $_GET['id']; ?>" readonly style="text-align: center" />
</div><div style="clear: both;"></div>
<?php
}
?>
<div style="width: 430px;;">
<label for="ag_dia" style="padding-bottom: 5px;">Dia</label>
<input type="text" name="ag_dia" id="ag_dia" class="text ui-widget-content ui-corner-all"
<?php
if ($validaRes == true) { echo 'value = "' . utf8_encode($resVideo->dia) . '"'; }
?> />
<label for="ag_mes" style="padding-bottom: 5px;">Mes</label>
<input type="text" name="ag_mes" id="ag_mes" class="text ui-widget-content ui-corner-all"
<?php
if ($validaRes == true) { echo 'value = "' . utf8_encode($resVideo->mes) . '"'; }
?> />
<label for="ag_ano" style="padding-bottom: 5px;">Ano</label>
<input type="text" name="ag_ano" id="ag_ano" class="text ui-widget-content ui-corner-all"
<?php
if ($validaRes == true) { echo 'value = "' . utf8_encode($resVideo->ano) . '"'; }
?> />
</div>
<div style="width: 430px;;">
<label for="ag_evento" style="padding-bottom: 5px;">Evento</label>
<input type="text" name="ag_evento" id="ag_evento" class="text ui-widget-content ui-corner-all"
<?php
if ($validaRes == true) { echo 'value = "' . utf8_encode($resVideo->evento) . '"'; }
?> />
</div>
<div style="width: 430px;">
<label for="ag_local" style="padding-bottom: 5px;">Local</label>
<input type="text" name="ag_local" id="ag_local" class="text ui-widget-content ui-corner-all"
<?php
if ($validaRes == true) { echo 'value = "' . utf8_encode($resVideo->local) . '"'; }
?> />
</div>
<div style="width: 430px;">
<label for="ag_link" style="padding-bottom: 5px;">Link</label>
<input type="text" name="ag_link" id="ag_link" class="text ui-widget-content ui-corner-all"
<?php
if ($validaRes == true) { echo 'value = "' . utf8_encode($resVideo->link) . '"'; }
?> />
</div>
<div style="width: 200px; margin-top: 10px;">
<label for="vid_status" style="padding-bottom: 5px">Status</label>
<input type="radio" name="vid_status" id="vid_status" value="A" style="float:left; position: relative; top: 3px;"
<?php if ($validaRes == true && $resVideo->status == "A") {echo "checked=\"checked\"";} if ($acao == "CADASTRAR") {echo "checked=\"checked\"";} ?>>
<p style="float:left; font-size: 13px; margin-left: 5px;">Ativo</p>
<div class="break"></div>
<input type="radio" name="vid_status" id="vid_status" value="I" style="float:left; position: relative; top: 3px;"
<?php if ($validaRes == true && $resVideo->status == "I") {echo "checked=\"checked\"";} ?>>
<p style="float:left; font-size: 13px; margin-left: 5px;">Inativo</p>
</div>
</div>
<div style="clear: both; margin-top: 25px; padding-bottom: 20px">
<input type="submit" name="btn_form_noticia" id="btn_form_noticia" value="<?php echo $acao; ?>" class="ui-button ui-corner-all ui-widget-header pagButton" />
</div>
</fieldset>
</form>
<?php
if (isset($_POST['btn_form_noticia'])) {
$ag_dia = utf8_decode($_POST['ag_dia']);
$ag_mes = utf8_decode($_POST['ag_mes']);
$ag_ano = utf8_decode($_POST['ag_ano']);
$ag_evento = utf8_decode($_POST['ag_evento']);
$ag_local = utf8_decode($_POST['ag_local']);
$ag_link = utf8_decode($_POST['ag_link']);
$vid_status = utf8_decode($_POST['vid_status']);
$table = "agenda";
if ($acao == "ATUALIZAR") {
$fieldsTable = array('ano', 'mes', 'dia', 'evento', 'local', 'link', 'status', 'id');
$valuesTable = array($ag_ano, $ag_mes, $ag_dia, $ag_evento, $ag_local, $ag_link, $vid_status, $_GET['mes']);
$query = $crud->updateDataset($fieldsTable, $valuesTable, $table);
$msg = "Agenda atualizado com sucesso!";
}
else if ($acao == "CADASTRAR") {
$fieldsTable = array('ano', 'mes', 'dia', 'evento', 'local', 'link', 'status');
$valuesTable = array($ag_ano, $ag_mes, $ag_dia, $ag_evento, $ag_local, $ag_link, $vid_status);
$query = $crud->insertDataset($fieldsTable, $valuesTable, $table);
$msg = "Agenda cadastrado com sucesso!";
}
if ($query == true) {
echo '
<script>
$(function() {
$( "#dialog-confirm" ).dialog({
autoOpen: true,
resizable: false,
width: 400,
height:200,
modal: true,
buttons: {
"Ok": function() {
window.location.href="' . $url . 'agenda/0/";
}
}
});
});
</script>
<div id="dialog-confirm" title="Concluído!" style="display: none">
<div style="margin-top: 20px">
<span class="ui-icon ui-icon-alert" style="float:left; position: relative; top: 3px"></span>
<div>' . $msg . '</div>
</div>
</div>
';
}
}
?>