Jump to content

funbinod

Members
  • Content count

    480
  • Joined

  • Last visited

Community Reputation

3 Neutral

About funbinod

  • Rank
    Member
  • Birthday 05/12/1983

Contact Methods

  • Yahoo
    funbinod
  • Skype
    binod.anuj

Profile Information

  • Location
    Nepal

Previous Fields

  • Languages
    HTML, PHP, JAVASCRIPT

Recent Profile Visitors

5,244 profile views
  1. funbinod

    insert csv into mysql problem

    PHP error is enabled. and there is nothing added on error log of my cpanel. the only thing happens when i post the csv file is - "Aw, Snap" page. its so much confusing. it works very fine when i use LOAD DATA method.
  2. funbinod

    insert csv into mysql problem

    i've posted the screenshot. it just displays "Aq, Snap!" DEV TOOLS also disconnects. and yes! the file upload is done through jQuery ajax. when i check manually, the file uploads but the mysql inserting part is not executed. and i found some mistakes on my code. i corrected it as following. but it still is not performing the action. $q = $mysqli->prepare("INSERT INTO projects (name, ctrtype, budhead, code, wardno, govallo, startdate, enddate, fy, cid, uid) VALUES (?,?,?,?,?,?,?,?,?,?,?)"); if (!$q) { echo "<div id='success'>NO</div>"; echo "<div id='msg'>Error: $mysqli->error</div>"; } else { $q->bind_param("siisidssiii", $prjname, $ctrtype, $data[2], $data[3], $data[4], $data[5], $data[6], $data[7], $ay, $cid, $uid); if (!$q->execute()) { echo "<div id='success'>NO</div>"; echo "<div id='msg'>Error: $q->error</div>"; } else { echo "<div id='success'>YES</div>"; echo "<div id='msg'>SUCCESSFULLY INSERTED DATA IN FILE!</div>"; $_SESSION["msg"] = "SUCCESSFULLY INSERTED DATA IN FILE!"; } }
  3. funbinod

    insert csv into mysql problem

    because i want to filter data supplied in the csv file.
  4. funbinod

    insert csv into mysql problem

    hello all! i am trying to upload and insert data on a csv file to mysql. it uploads but could not insert data to mysql. following is the work i've done. $handle = fopen($targetpath, 'r'); $firstline = true; while (($data = fgetcsv($handle, 5000, ',')) !== FALSE) { if (!$firstline) { $continue = true; if ($data[0] == "" && $data[1] == "" && $data[2] == "" && $data[3] == "" && $data[4] == "" && $data[5] == "" && $data[6] == "" && $data[7] == ""){ $continue = false; } if (strlen($data[0]) != strlen(utf8_decode($data[0]))) { $prjname = ($data[0]); } else { $prjname = strtoupper($data[0]); } if ($data[1] == "CONTRACTOR") { $ctrtype = 1; } else if ($data[1] == "USER COMMITTEE") { $ctrtype = 2; } else { $continue = false; } if (!is_numeric($data[2])) { $continue = false; } if ($continue == true) { $q = $mysqli->query("INSERT INTO projects (subdate, name, ctrtype, budhead, code, wardno, govallo, startdate, enddate, fy, cid, uid) VALUES ('$subdate', '$prjname', '$ctrtype', '$data[2]', '$data[3]', '$data[4]', '$data[5]', '$data[6]', '$data[7]', '$ay', '$cid', '$uid')"); if (!$q) { echo "<div id='success'>NO</div>"; echo "<div id='msg'>Error: $mysqli->error</div>"; } else { $q->bind_param("siisidssiii", $subdate, $prjname, $ctrtype, $data[2], $data[3], $data[4], $data[5], $data[6], $data[7], $ay, $cid, $uid); if (!$q->execute()) { echo "<div id='success'>NO</div>"; echo "<div id='msg'>Error: $q->error</div>"; } else { echo "<div id='success'>YES</div>"; echo "<div id='msg'>SUCCESSFULLY INSERTED DATA IN FILE!</div>"; $_SESSION["msg"] = "SUCCESSFULLY INSERTED DATA IN FILE!"; } } } } $firstline = false; } unlink($path); can u please guide where i did mistake??? thank u in advance..
  5. funbinod

    setting page break

    tr:nth-child(4n) {page-break-after: always;} this didnot work as expected
  6. funbinod

    setting page break

    hello all! i was trying to set page break while printing my html page after every 4 table rows. can anyone guide me??? thanks in advance.
  7. funbinod

    finding elements with data- attributes

    i solved the problem using ".attr('itype', itype)" instead of using .data(). but is it ok to use non-standard attributes?
  8. funbinod

    finding elements with data- attributes

    thank u for the reply. but i didnot what you asked to check in the developer tools. i've checked in my own way if it adds a data attribute to the span or not. i had mentioned this above also. i checked it in two ways. after adding the data-itype i tried to count the span number with data-itype='F' alert($(".regmattable").find("span[class='matcosts'][data-itype='F']").length); it alerts 0 (zero). but when i check if there is data-itype set alert($(".regmattable").find("span[class='matcosts']").data("itype")); it alerts 'F', as i've set earlier. this means data-itype is set with the given value to the selected span, but i could not find the span with the data attribute.
  9. hello experts! i mate a problem while trying to find elements with dynamically set data attribute. first i set data attribute like this ... $("span[class='matcosts']").data("itype", "F"); second i try to find it ... $(".regmattable").on("keyup", ".matcount", function(e) { alert($(".regmattable").find("span[class='matcosts'][data-itype='F']").length); // both 'matcount' and 'matclass' are insite 'regmattable' }) this above code alerts 0 (zero). but when i try to find the data from the 'matcosts' span (as below), it gives 'F' (as i passed it before). alert($(".regmattable").find("span[class='matcosts']").data("itype"); can u tell me where did i make mistake? and please can u guide me how can i achieve this???? thank you in advance.
  10. funbinod

    return ajax data outside the ajax

    i don't know! i was just wondering for this. thank u for the reply. and i think i need to move those lines inside the success function. i wish some more guidance here. will u please help me?? from the ajax request, i get current latitude and longitude data from my gps tracker device. and to place a marker to the map i send those data to another page like below and load that page to a div in the current page. success: function(res) { var lat = res[imei].lat; var lng = res[imei].lng; if (loaded == "NO") { var loadmapurl = "gps.php?lat=" + lat + "&lng=" + lng; $("#loadmap").load(loadmapurl); loaded == "YES"; } else { var latlng = new google.maps.LatLng(lat, lng); marker.setPosition(latlng); } } setTimeout(executeQuery, 5000); this ajax request is loaded every 5000ms. for each ajax success function, i check if the map page is loaded already or not. and if the page is loaded already loaded i wish not to load the page anymore but to move the marker according the current latitude and longitude value. the marker variable inside the else block is from the loaded page (i.e.: "gps.php?........"). is the above try good to perform my requirement? is the above try to load a map is good enough? or i've to try something else to load a map? (NOTE: i cannot say what happens with this current code because there is a header setting error (i.e.: access-control-allow-origin header not present......) on my gps service provider api link.) thank you in advance.
  11. i was trying to use a ajax returned value out of the ajax function but it didn't work. can anyone please guide me. here is the code i tried. var lat, lng; $.ajax({ url: url, dataType: "json", method: "get", success: function(res) { var lat = res[imei].lat; var lng = res[imei].lng; } }); $("#lng").text(lng); $("#lat").text(lat); thanks in advance.
  12. funbinod

    class attribute selector for autocomplete field

    very good suggestion. i didnot know about data attribute in html 5 and jquery. your guidance made me clear almost all about data- attribute. but one thing more. i got confused using selector for this attribute. shall i have to use, in jquery $("input[data-class='resultdate'"] or there is something special method for this? thank u.
  13. hello all! i've a autocomplete field which has a class attribute 'resultdate'. and i want to select that element using its class attribute. but when i try to catch that field i found that the autocomplete specified class is also added to it. $(function() { $('.resultdate').autocomplete({ ////// this is an input field and i've many input fields with different class names. source: "selectdate.php", minLength: 0, autoFocus: false, select: function(e) { $(this).val($(this).substr(0,10)); } }).focus(function(){ $(this).autocomplete("search"); }) }); $('#editmain input').on('keypress', function(e) { if (e.which === 13) { e.preventDefault(); $("#msg").empty().hide(); var thisid = $(this).attr("termid"); var col = $(this).attr("class"); // i use the class to identify the field and update it through ajax request alert(col); var newvalue = $(this).val(); editterm(thisid, col, newvalue); } }) for other plain input field (means the inputs that donot have any autocomplete function) it works fine. but for autocomplete field (for example class='resultdate') this gives 'resultdate ui-autocomplete-input' as its class please guide how can i select the only class that i,ve specified? thank u in advance..
  14. funbinod

    running ajax only once inside a for loop

    wow! it worked nicely! thank you for the guidance!
  15. hello all, i am trying to run an ajax request inside a for loop. and when the response is true, i want to run another ajax only once. but the second ajax also runs multiple times. here is the code i tried .... var i; for (i=0; i< feeid.length; i++) { $.ajax({ url: "submitnewjournal.php", method: "POST", data: { m: m, fullvn: fullvn, vn: vn, }, }) .done (function(result) { var success = $(result).filter("#success").text(); $("#msg").text($(result).filter("#msg").text()); if (success == "NO") { $('#pwait').hide('clip', "fast"); $("#msg").css("color", "red").show("bounce", 100); $('#feelist, #studentlist').show('fade', 250); } else { $("#msg").css("color", "green").show("bounce", 100); $("#fullvn").text($(result).filter("#newfullvn").text()); $("#prefix").text($(result).filter("#newprefix").text()); $("#vn").text($(result).filter("#newvn").text()); /***********************************************************************************************/ /************************* this is the part i want to run onle one time*************************/ /***********************************************************************************************/ if (sendnotice == "Y") { $("#msg").text("Invoice saved successfully. Now sending notification!"); var target = "< PARENTS >"; var receipients = "INVOICE"; var clas = $('#clas :selected').val(); var sec = $('#sec').val(); $.ajax({ url: "noticeprocess.php", method: "POST", data: { target: target, targetid: target, receipient: receipients, token : receipients } }) .done(function(result) { $("#msg").hide("fade", 100).empty().text($(result).filter("#msg").text()); var success = $(result).filter("#success").text(); if (success == "YES") { $("#msg").css("color", "green").show("bounce", 100); $("#pwait").hide("clip", "fast"); // $('#mainarea').load('mnthsalary.php'); } else if (success == "NO") { $("#msg").css("color", "red").show("bounce", 100); } }) .fail(function(e) { $("#msg").hide("fade", 100).empty().text("Connection Error!").css("color", "red").show("bounce", 100); }) window.open("print.php?m=newmnthinvoice&invno=" + fullvn, "_new"); /*********************************************************/ } else { $("#msg").text("Invoice saved successfully."); $('#pwait').hide('clip', "fast"); } } }) .fail(function() { $('#pwait').hide('clip', "fast"); $('#msg').text('Connection problem!').css('color', 'red'); $('#feelist, #studentlist').show('fade', 250); }) } please guide me how can i achieve this. thank u in advance....
×