Jump to content

funbinod

Members
  • Content Count

    498
  • Joined

  • Last visited

Community Reputation

3 Neutral

About funbinod

  • Rank
    Member
  • Birthday 05/12/1983

Previous Fields

  • Languages
    HTML, PHP, JAVASCRIPT

Profile Information

  • Location
    Nepal

Contact Methods

  • Yahoo
    funbinod
  • Skype
    binod.anuj

Recent Profile Visitors

6,025 profile views
  1. thank you for the reply. i already tried to put the position of selected row using "index". but that also returned same problem. but now i solved the problem with a slight change on the above code. i just replaced ------------ .data("selected", 'Y') to .attr("data-selected", 'Y')
  2. hello all i am trying to use 'keydown' function to move through html rows. but i could not succeed. here is what i tried-- $("body").on("keyup", function(e) { if ($("#mid").find(".maintable tr[data-selected='Y']").length == 0) { $("#mid").find(".maintable tr").first().data("selected", 'Y').addClass("thisrow"); } else { if (e.which === 40) { $("#mid").find(".maintable tr[data-selected='Y']").next().data("selected", 'Y').addClass("thisrow"); $("#mid").find(".maintable tr[data-selected='Y']").first().data("selected", 'N').removeClass("thisrow"); } else if (e.which === 38) { $("#mid").find(".maintable tr[data-selected='Y']").prev().data("selected", 'Y').addClass("thisrow"); $("#mid").find(".maintable tr[data-selected='Y']").last().data("selected", 'N').removeClass("thisrow"); } } }) in the above code, '#mid' is a div that holds data retrieved from jQuery.ajax function. below is the backend code data from which is attached to the '#mid' div. $data = "<table class='maintable'>"; $sn = 0; while ($r = $q->fetch_object()) { $sn++; $name = $r->name; $aid = $r->aid; $ac_id = $r->ac_id; $ob = $r->ob; $data .= " <tr data-target='acregister.php?aid=$aid&m=e' data-selected='N'> <td>$name</td> <td style='width: 150px;'>$ac_id</td> <td style='width: 150px;'>$ob</td> </tr>"; } $data .= "</table>"; echo $data; here i want to use up and down arrows to move through the rows retrieved from ajax function. on the rows i've attached 'data-selected' value to know which row is selected. and on each keydown function i want change the 'data-selected' value of next row to 'Y' and change its value to 'N' for the previous one. the above code worked only once. it changed the value for new row but didnot change the value for the previous one and hence when i press down arrow, it selects first row but does not move to next row on another down arrow press. please guide me, what i missed?
  3. thank u for the replay. it worked. its great suggestion. thank u again.
  4. hello all! i'm trying something for binding parameters to a prepared statement like below. $tbl = 'stock'; $cols = 'icode=?, item=?, catid=?, description=?, unitid=?, pprice=?, sprice=?, oqty=?, oprice=?, oamt=?, bcode=?'; // $vals = "'101', 'ASUS H61M-E', 'abcde', '2', '1', '5300.00', '6500.00', '11', '5300', '55528', '101'"; $vals = "101, ASUS H61M-E, abcde, 2, 1, 5300.00, 6500.00, 11, 5300, 55528, 101"; $uq = $mysqli->prepare("UPDATE $tbl SET $cols WHERE $whcol='$whval'"); if (!$uq) { $msg = "Error1: $mysqli->error!"; } else { $uq->bind_param('sssssssssss', $vals); // this doesn't work. // $uq->bind_param('sssssssssss', 101, ASUS H61M-E, abcde, 2, 1, 5300.00, 6500.00, 11, 5300, 55528, 101); // but this works well. if (!$uq->execute()) { $msg = "Error3: $uq->error!"; ///// this says "No data supplied for parameters in prepared statement." } else { $msg = "UPDATED successfully!"; } } here i'm trying to put all the update values into a string and then bind it to the statement. but this says "No data supplied for parameters in prepared statement". but when i use individual values, it works fine. please suggest me something. thanks in advance.
  5. i found that what i learnt so far is also wrong. i corrected the aforementioned code like this $cuidstmt = $pgsql->prepare("SELECT cid, uid FROM user WHERE name=?"); if(!$cuidstmt) { echo "Error: " . $pgsql->errorInfo()[2]; } else { $cuidstmt->execute(array($u)); $cuidstmt->execute(); $cuidstmt->fetch(); } but i still couldn't understand how can i get the result(s). where can i get the data from 'cid' and 'uid' columns mentioned in the prepared statement. thank u all in advance.
  6. hello all! i'm learning postgresql. i was just trying to fetch some data using prepared statement. but found that it is quiet different than mysql. the all i learnt searching on the web is this. $cuidstmt = $pgsql->prepare("SELECT cid, uid FROM user WHERE name=?"); if(!$cuidstmt) { echo "Error: " . $pgsql->errorInfo()[2]; } else { $cuidstmt->bindParam('i', $u); $cuidstmt->execute(); $cuidstmt->fetch(); } but i could not understand how can i print the required data. where the data is stored. just like in mysqli we can bind result on a string, how can i do that in pgsql? can u please help me?
  7. hello all. i was just wondering between these two versions of PHP - 5 & 7. right now i'm practicing on if PHP 5. and now i'm thinking of upgrading to PHP 7. and i want to know if my current code works with the new version or not. if i upgraded my PHP to 7, should i need to change all or some parts of the codes? thank you in advance.
  8. funbinod

    mysql audit trial

    hello all! i was wandering through web to learn about audit trial. but could not find anything from where i can understand this clearly. can anyone please tell me in details about this??? for nowm i want to know two things: 1) is this automatically done by mysql as it's feature or this is my job to maintain the complete activity??? 2) if this is a mysql feature, is this available on all versions??? thank you in advance...
  9. this hint solved my problem. i cheated the code like below. .......... AND projtype IN (SELECT id FROM projcat WHERE under=1 UNION SELECT id FROM projcat WHERE id=1 UNION SELECT id FROM projcat WHERE under IN (SELECT id FROM projcat WHERE under=1)) thank u very very much...
  10. thank you for the reply. but it banged my head. this is beyond my practice and is very tough to understand. can't it be done with a simple modification to my code???? like........ .......... AND projtype IN (1, SELECT id FROM projcat WHERE under=1 UNION SELECT id FROM projcat WHERE under IN (SELECT id FROM projcat WHERE under=1)) thank u again.
  11. hello all! i am struggling with a problem in mysql. i want to select all rows from a table with an id and its child ids. i tried the following ............... AND projtype IN (SELECT id FROM projcat WHERE under=1 UNION SELECT id FROM projcat WHERE under IN (SELECT id FROM projcat WHERE under=1)) it works. But this selects rows that matched the child ids only. i want to select all the rows which use the parent id also (i.e. '1' on the given example). please help me with some hints. thanks in advance....
  12. hi all! after long time i'm back here with a problem. i want to select all data attributes from a div with its name and value using jquery each function use that elsewhere. here is the html for the div. <div class='EW' data-rowid='1' data-unit='' data-workdesc='description' data-vby='2' data-distanceTot='50' data-AVcutTot='500' data-VcutTot='25000'></div> and i tested the following to get my result. var datas = $(".EW").attributes; $.each(datas, function(i,item) { $("#msg").text(item.name + ":" + item.value); }) but i could not get any result. can u please guide me what is wrong? or suggest me any other best method to achieve this. thank you in advance.
  13. thank u. this suggestion solved the problem var remove = []; for (i=enclass; i<=12; i+=enclass) { remove.push(i); } if ($.inArray(parseInt($(this).parent("td").attr("class")), remove) == -1) { $(this).remove(); }
  14. hello all! i was trying to do a for loop to remove all elements that does not meet the for loop. following is the code i tried. $("#feetable input").each(function(e) { var thisvalue = $(this).val(); var enclass = 3; var i; for (i=enclass; i<=12; i+=enclass) { if ($(this).parent("td").attr("class") == i && $(this).val() == thisvalue) { $(this).remove(); } } }) and here is the html <td class='1'><input type='checkbox' /></td> <td class='2'><input type='checkbox' /></td> <td class='3'><input type='checkbox' /></td> <td class='4'><input type='checkbox' /></td> <td class='5'><input type='checkbox' /></td> <td class='6'><input type='checkbox' /></td> <td class='7'><input type='checkbox' /></td> <td class='8'><input type='checkbox' /></td> <td class='9'><input type='checkbox' /></td> <td class='10'><input type='checkbox' /></td> <td class='11'><input type='checkbox' /></td> <td class='12'><input type='checkbox' /></td> this removes the exact elemetns that the for loop finds (i.e. inputs under <td>s with class 3, 6, 9, 12). but my aim is to keep those inputs and remove others. and when i try to reverse the code as below it removes all the inputs. if ($(this).parent("td").attr("class") != i && $(this).val() == thisvalue) { $(this).remove(); } please guide me. thanks in advance.
  15. wow! this solved the problem. i checked for all the tables and found some columns be empty that led to this problem. i corrected them and found that the above code is working properly. thank u for the idea.
×
×
  • Create New...