Click here to Skip to main content
15,438,920 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
QuestionSubtraction of sum of 2 different table colums Pin
Mick Chambers17-Jun-20 21:58
MemberMick Chambers17-Jun-20 21:58 
AnswerRe: Subtraction of sum of 2 different table colums Pin
Richard MacCutchan17-Jun-20 23:43
mveRichard MacCutchan17-Jun-20 23:43 
GeneralRe: Subtraction of sum of 2 different table colums Pin
Mick Chambers18-Jun-20 2:11
MemberMick Chambers18-Jun-20 2:11 
GeneralRe: Subtraction of sum of 2 different table colums Pin
Richard MacCutchan18-Jun-20 4:39
mveRichard MacCutchan18-Jun-20 4:39 
GeneralRe: Subtraction of sum of 2 different table colums Pin
Mick Chambers18-Jun-20 2:13
MemberMick Chambers18-Jun-20 2:13 
GeneralRe: Subtraction of sum of 2 different table colums Pin
Richard MacCutchan18-Jun-20 4:40
mveRichard MacCutchan18-Jun-20 4:40 
QuestionHow to handle response after PayPal subscription approval Pin
Petar Vasilev1-May-20 10:27
MemberPetar Vasilev1-May-20 10:27 
Questionhow to add additional in php query or jquery Pin
captan389926-Apr-20 21:57
Membercaptan389926-Apr-20 21:57 
i have query php like this


PHP
<?php
include('../config.php');

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    if(isset($_POST['pasar'])){
        $code = $mysqli->real_escape_string($_POST['pasar']);
        $queryPeriode = $mysqli->query("SELECT * FROM tb_periode WHERE code_pasaran = '".$code."' ORDER BY no DESC LIMIT 10");

        $data = [];
        while ($result = $queryPeriode->fetch_assoc()) {
            $data[] = [
                "periode" => $result['no'],
            ];
        }
        echo json_encode($data) ;

    }
}
?>


my js code is like this


JavaScript
$("#pasaran").on('change',function(e) {
        $("#periode").html("");
        let code = $(this).val();

        $.ajax({
            method: "POST",
            url: "?page=get_data_priode",
            data: {pasar:code},
            dataType: "json",
        })
        .done(function( data ) {            

            $.each( data, function( key, value ) { 
                $( "#periode" ).append("<option value="+value.periode+">"+value.periode+"</option>");
            });

        });

        e.preventDefault(); 
    });


the result is like this
[

0: {periode: "1521"}
1: {periode: "1520"}
2: {periode: "1519"}
3: {periode: "1518"}
4: {periode: "1517"}
5: {periode: "1516"}
6: {periode: "1515"}
7: {periode: "1514"}
8: {periode: "1513"}
9: {periode: "1512"}

]

but i want is the result after 1521 have result 1522 how can i do it? can someone teach me? how to do like that? me already tried to searching my quested in google but still no have answer

AnswerRe: how to add additional in php query or jquery Pin
Richard MacCutchan26-Apr-20 22:35
mveRichard MacCutchan26-Apr-20 22:35 
AnswerRe: how to add additional in php query or jquery Pin
Richard Deeming27-Apr-20 0:33
mveRichard Deeming27-Apr-20 0:33 
Questionsocket_send not working without break or exit Pin
Member 147929365-Apr-20 2:04
MemberMember 147929365-Apr-20 2:04 
QuestionHow to share session cookies from a PHP application with my WordPress website, hosted on the same server and the same domain? Pin
mplusplus29-Dec-19 17:50
Membermplusplus29-Dec-19 17:50 
AnswerRe: How to share session cookies from a PHP application with my WordPress website, hosted on the same server and the same domain? Pin
who8mypnuts31-Dec-19 16:28
Memberwho8mypnuts31-Dec-19 16:28 
QuestionSubmit to view hyperlink using PHP? Pin
Member 829590119-Jul-19 10:11
MemberMember 829590119-Jul-19 10:11 
Questionphp + validation ajax + ISSET() Pin
nelsonpaixaopinto16-May-19 12:51
Membernelsonpaixaopinto16-May-19 12:51 
QuestionFailover Architecture (Apache/TOMCAT) Pin
Member 143600218-May-19 3:21
MemberMember 143600218-May-19 3:21 
Questionwhat is the error:mysqli_query() expects parameter 1 to be mysqli, null given in Pin
Amir karim30-Apr-19 7:29
MemberAmir karim30-Apr-19 7:29 
AnswerRe: what is the error:mysqli_query() expects parameter 1 to be mysqli, null given in Pin
Richard MacCutchan30-Apr-19 21:39
mveRichard MacCutchan30-Apr-19 21:39 
AnswerRe: what is the error:mysqli_query() expects parameter 1 to be mysqli, null given in Pin
Member 1456979427-Aug-19 7:03
MemberMember 1456979427-Aug-19 7:03 
Questionany latest api for currency converter free Pin
Member 1434851229-Apr-19 21:32
MemberMember 1434851229-Apr-19 21:32 
AnswerRe: any latest api for currency converter free Pin
OriginalGriff29-Apr-19 21:34
mveOriginalGriff29-Apr-19 21:34 
AnswerRe: any latest api for currency converter free Pin
Richard MacCutchan29-Apr-19 21:35
mveRichard MacCutchan29-Apr-19 21:35 
QuestionUtilize webhook using PHP Webhook Listener Pin
Jassim Rahma18-Apr-19 5:04
MemberJassim Rahma18-Apr-19 5:04 
QuestionHaving Trouble moving my Wordpress site offline using MAMP Pin
Davstr15-Apr-19 8:02
MemberDavstr15-Apr-19 8:02 
QuestionConvert the sql query into linq Pin
Member 1246113211-Apr-19 22:52
MemberMember 1246113211-Apr-19 22:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.