0
Good afternoon guys, I have an ajax filter that filters 1 result only. I need to filter two conditions, like a month and a person’s name in a schedule table. How can I do?
<script type="text/javascript">
$('#show_pessoa'),('#mes-agenda').change(function () {
var chars = (this.value);
var chars2 = (this.value);
$.post('../Ajax/pessoa_agenda', {val: chars, val2: chars2}, function (busca) {
$('#content-left').html(busca);
});
});
</script>
$char = $_POST['val'];
$char2 = $_POST['val2'];
$dados = connection::select("Select * from agenda where pessoa= '" . $char . "' and mes = '" . $char2 . "'");
Put a button to check name or something like that, when the person clicks, already presses the 2 values at once, because this way it will not work. If the person type only in the name field and the month field is empty will only the name field value and the query result may be the unexpected.
– Romario Pires
From what I understand you want to return the month and the name of a person on the agenda table, correct? My suggestion you can select and return a Json.
– Marconi
Return all data but filtering month and name together. This via ajax.
– Eduardo Santos
Pilgrimage, I thought about it too. It’s much easier anyway. But I’ll try to do by Ajax.
– Eduardo Santos
What would this filter be? If you will filter after bringing all the data from the database, it makes no sense not to filter this in the query. 'Cause you bring everything so you don’t use everything from there...
– Fleuquer Lima