Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by funbinod


    depending on jquery version look up live(), migrate(), or .on(),


    i'm using jquery version 2.1.0


    jquery api said live is deprecated.


    using on event handler also did nothing.


    console log shows nothing..


    and yes! .live() event worked after migrating jquery to version 1.2.1 :). but I don't want, if there is other option, to migrate to older version



  2.   $n = 0;  while ($qr = $qq->fetch_assoc()) {	  $n++;          <a class="email" id="email'.$n.'">'.$aemail.'</a>;}
    		<script>		$("#email<?php echo $n; ?>").click(function(e) {			$("body").append("<div id=pop><div id=popin><br /><br /><input id=emaill type=text value='<?php echo $aemail; ?>' /><br /><br /><input type=button id='close' value=CLOSE /></div></div>");			$("#popin").effect("slide", {easing:"easeInOutElastic"},3000);			$("#emaill").focus();   		});		</script>

    the javascript inside while loop


    and this worked now...

  3. I was trying to get a popup div on click handler.

    		$("#email").click(function(e) {			$("body").append("<div id=pop><div id=popin><br /><br /><input id=emaill type=text value='<?php echo $aemail; ?>' /><br /><br /><input type=button id='close' value=CLOSE /></div></div>");			$("#popin").effect("slide", {easing:"easeInOutElastic"},3000);			$("#emaill").focus();   		});

    but I failed to remove (or close) that div on another click handler..

    the following is what I tried to close that div...

    	$('#pop').click(function(e) {            $(this).empty();        });

    this try is not working. what could be the best way to do this??? please guide me...


    If you're trying to fill in the email address associated with the link then put the email address as a data attribute on the anchor tag and get it in the click handler to fill in


    i'm doing this. but the problem is that I want the email address on a "div" on the "same page" that is appended on click event, not on a "new popup window". I know how to use "data attribute on the anchor tag" to a new window, as u suggested. but I don't know how to do that on the same page.. will u please guide me to this...??? :(

  5. I have columns from some rows of a MySQL table using php.

    while ($qr = $qq->fetch_assoc()) {    echo '<a id="email">'.$qr['email'].'</a>';}

    there are multiple rows. but when I click and any of the derived emails, I want that email to be displayed on the popuped div

    	$("#email").click(function(e) {		$("body").append("<div id=pop><div id=popin><br /><br /><input id=emaill type=text value='<?php echo $aemail; ?>' /><br /><br /><input type=button id=close value=CLOSE /></div></div>");		$('#popin').effect('slide', {easing:'easeInOutElastic'},3000);		$('#emaill').focus();   	});

    I don't what exactly I've to do for this but I've kept the javascript outside the while loop and its not working.


    can anyone guide me for this???? :(



    thanks in advance...

  6. i'm trying jquery autocomplete using following----

    <script>$(function() {	$( "#icode" ).autocomplete({		source: "icode.php"	});});</script>

    and the icode.php is-----

    <?phprequire_once('functions.php');$q = strtolower(mysqli_real_escape_string($connect, $_REQUEST["term"]));$return = array();$query = mysqli_query($connect, "SELECT icode, item, sprice, pprice FROM stock WHERE icode LIKE '$q%' AND cid='$cid' ORDER BY icode") or die("Error: ".mysqli_error($connect));while ($row = mysqli_fetch_array($query)) {	array_push($return,array('value'=>$row['icode'].':'.$row['item'].':'.$row['pprice'].':'.$row['sprice']));}echo(json_encode($return));?>

    everything is fine. the autocomplete list displays all the information that is collected in the icode.php page.


    what I wish additional is that the autocomplete list display all the information but when user select from the list, only the "$row['icode']" should be selected.




    thanks in advance

  7. I was retrieving only one row from a table. in localhost it gave good result. but while using online, it says memory size exhausted. perhaps there are different settings on my localhost and webhost regarding memory size. but I wondered that how can the memory be exhausted while retrieving information from only one row? or there is problem in my query??


    the following is the query I used.

    $sql = "SELECT icode,item,description,catid,unitid,pprice,sprice,oqty,oprice,bcode,oamt FROM stock WHERE sid=? AND cid=?";if($stmt = $mysqli->prepare($sql)) {	$stmt->bind_param('si', $sid, $cid);	$stmt->execute();	$stmt->bind_result($icode,$items,$desc,$catid,$unitid,$pprice,$sprice,$oqty,$oprice,$bcode,$oamt);	$stmt->fetch();	$stmt->free_result();}

    is there any problem in my statement that uses highest memory??

  8. oh yes! thank u! :)


    I understood what u pointed. but I didn't what u suggested (coz I know less on using class). but I made one logic and solved it. I generated an unique id for each row and attached it to the 'id' and modified the jquery with respect to it. below is what I did-----

    $rn = 0;while ($row = ...................) {    $rn++;    echo "    <tr>        <td>".$row['abc']."</td>        <td><a id='delete".$rn."' href='delete.php?m=$m&abc=$row[abc]'>DELETE</a></td>        <script>        $(document).ready(function(e) {            $('#delete".$rn."').click(function(e) {		var conf = confirm('Sure Delete!?')		if (!conf) {		    event.preventDefault();		}            });        });        </script>    </tr>    ";}

    what u think, this would be good to use or not?

  9. (sorry if I had to ask it on php forum)


    inside a php while loop can I run jquery (or javascript) for each row???


    I tried the following ---------------

    while ($row = ...................) {    echo "    <tr>        <td>".$row['abc']."</td>        <td><a id='delete' href='delete.php?m=$m&abc=$row[abc]'>DELETE</a></td>        <script>        $(document).ready(function(e) {            $('#delete').click(function(e) {		var conf = confirm('Sure Delete!?')		if (!conf) {		    event.preventDefault();		}            });        });        </script>    </tr>    ";}

    but this jquery script works for the first row only and not to other rows. how can I run this confirm script for each row generated by while loop?????


    thank u in advance....

  10. ok! I got it now and solved it.


    I did the mistake. I had placed the initial value of $bal inside the loop. now I placed the initial value of $bal (i.e. $bal = $prebal) before starting a loop.

    $bal = $prebal;foreach ($period as $month) {    ......................;    ......................;        $bal += ($svalue - $pvalue);    echo $bal;}

    this solved the problem. thank u both for your company....

  11. ok! let me guess and try something.

    assuming $bal is the rightmost column

    $bal = $prebal // this assumes the first ever row starts with some value calculated previously$bal += $svalue - $pvalue // preceding columnsecho $bal;

    is this the method you suggested me?


    but this calculated value for each row only. like, $prebal + $svalue - $pvalue. it didn't continued adding to further rows.



  12. understood nothing on the link that can guide me through what I wish..


    I understand of "having a set of variables to keep track of whatever I want" as u suggested. but my problem is for calculation using the value derived from the calculation between the values of previous row.... :(

  13. solved! thank u.


    now will u take me more deeper?


    I wonder if there is some method of calculation between arrays!! :(


    meaning, I want to calculate value(s) of this row with the value of previous row. below is the example..

    while ($row = ....................) {    $ttl = ($row['a']+$row['b']-$row['c']);    echo $row['a'] . ' | ' . $row ['b'] . ' | ' . $row['c'] . ' | ' . $ttl . '<br />';}

    but after each row I wish the value of $ttl on each rows be calculated in respect with the previous row..

    lets look with practical example...

    lets assume some data derived from above query...



    $row['a'] | $row['b'] | $row['c'] | $ttl | THIS


    9 | 2 | 3 | 8 | 8


    7 | 1 | 5 | 3 | 11


    8 | 6 | 4 | 10 | 21



    what I wish is the calculation of THIS column...


    on first row the value of $ttl is put on THIS column. on second row value of $ttl is added with value of THIS column of first row and put on THIS column of second row and so on third row...


    this is something like prev() function on an array...


    possible????? :(

  14. how can I print php arrays as we print sql arrays using while loop.?


    print_r ( ) returns array as

    Array ([1] => A [2] => B [3] => C [4] => D [5] => E)


    But I wish to print as








    That we get using sql query like...


    while {$row = mysqli_fetch_array($query) {






  • Create New...