Jump to content

amolv

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by amolv

  1. @TeNDoLLA i need index value , something where i can pass my search index and get next index ?
  2. Hi, I have array with mixed indexes, i wanted find after 'xyz' index, what is next index int value or string, how can i do that?
  3. very simple group by year,quarter Thank you all.
  4. $sq ="SELECT count(id),QUARTER(Date(last_call)) as quarter,YEAR(last_call) FROM $dbt.travel_crm WHERE Date(last_call) BETWEEN '".$_GET['startdate']."' AND '".$_GET['enddate']."' GROUP BY QUARTER(Date(last_call)) ORDER BY YEAR(last_call)"; giving only current years rows count, bcoz grouping by quarter, i need to group by (quarter,year) , how to do that? example id last_call 1 2010-10-30 10:56:00 2 2010-10-30 10:56:00 3 2011-01-30 10:56:00 4 2011-02-30 10:56:00 5 2011-03-30 10:56:00 6 2011-05-30 10:56:00 7 2011-04-30 10:56:00 8 2011-04-30 10:56:00 9 2011-05-30 10:56:00 10 2011-04-30 10:56:00 what to order by or how to order before group by?
  5. <script type="text/javascript"> // click functions are here which will controls pagination buttons enable and disable function pagebyclick1(dom,page){ count = dom.next().children().children().children('input').val(); if(count > 5 ) { if(page>1) { dom.next().children().children().children('span[class=previous]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=first]').attr('disabled', '').attr('style',"opacity:1;"); }else{ dom.next().children().children().children('span[class=previous]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=first]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); } if(page==count) { dom.next().children().children().children('span[class=next]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=last]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); }else{ dom.next().children().children().children('span[class=next]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=last]').attr('disabled', '').attr('style',"opacity:1;"); } } if(page == 1) { dom.next().children().children().children('span[class=previous]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=first]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); } var sl=parseInt(count)-1;var last=count; if(page == sl || page ==last ) { if(page==last){ dom.next().children().children().children('span[class=next]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=last]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); } if(count > 5 ){ for(var i=count-4,x=2;i<=count;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==page) { dom.next().children().children().children().removeClass('active'); dom.next().children().children().children().eq(x).addClass('active'); } } } }else if(page==1 || page==2 ) { if(page==1){ dom.next().children().children().children('span[class=previous]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=first]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); } if(count > 5 ){ for(var i=1,x=2;i<=5;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==page) { dom.next().children().children().children().removeClass('active'); dom.next().children().children().children().eq(x).addClass('active'); } } } }else { var start;var end; start=parseInt(page)-2;end=parseInt(page)+2; for(var i=start,x=2;i<=end;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==page) { dom.next().children().children().children().removeClass('active'); dom.next().children().children().children().eq(x).addClass('active'); } } } } function previouspage1(dom,page) { if(page !=2){ dom.next().children().children().children('span[class=active]').prev('span').addClass('active'); dom.next().children().children().children('span[class=active]').last().removeClass('active'); } dom.next().children().children().children('span[class=next]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=last]').attr('disabled', '').attr('style',"opacity:1;"); page=parseInt(page)-1; count = dom.next().children().children().children('input').val(); var sl=count-1;var last=count; if(page == sl || page ==last ) { //$("#"+dom+" span[class=active]").removeClass('active').prev().addClass('active'); }else if(page==1) { dom.next().children().children().children('span[class=previous]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=first]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children().removeClass('active'); dom.next().children().children().children().eq(2).html('1').addClass('active'); for(var i=2,x=3;i<=5;i++,x++){ dom.next().children().children().children().eq(x).html(i); } }else if( page==2 ){ } else { var start;var end; start=page-2;end=page+2; for(var i=start,x=2;i<=end;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==page) { dom.next().children().children().children().removeClass('active'); dom.next().children().children().children().eq(x).addClass('active'); } } } } function nextpage1(dom,page) { dom.next().children().children().children('span[class=active]').next('span').addClass('active'); dom.next().children().children().children('span[class=active]').first().removeClass('active'); dom.next().children().children().children('span[class=previous]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=first]').attr('disabled', '').attr('style',"opacity:1;"); page=parseInt(page)+1; count = dom.next().children().children().children('input').val(); var sl=count-1;var last=count; if(page == last){ dom.next().children().children().children('span[class=next]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=last]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); } else if(page == sl ) { }else if(page==1 || page==2 ) { }else { var start;var end; start=page-2;end=page+2; for(var i=start,x=2;i<=end;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==page) { dom.next().children().children().children().removeClass('active'); dom.next().children().children().children().eq(x).addClass('active'); } } } } function firstpage1(dom) { dom.next().children().children().children('span[class=next]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=last]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=first]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=previous]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children().removeClass('active'); count = dom.next().children().children().children('input').val(); for(var i=1,x=2;i<=5;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==1) { dom.next().children().children().children().eq(x).addClass('active'); } } } function lastpage1(dom) { dom.next().children().children().children('span[class=first]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=previous]').attr('disabled', '').attr('style',"opacity:1;"); dom.next().children().children().children('span[class=next]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children('span[class=last]').attr('disabled', 'true').attr('style',"opacity:0.5;cursor: auto;"); dom.next().children().children().children().removeClass('active'); count = dom.next().children().children().children('input').val(); for(var i=count-4,x=2;i<=count;i++,x++) { dom.next().children().children().children().eq(x).html(i); if(i==count) { dom.next().children().children().children().eq(x).addClass('active'); } } } function pagebyclick(count,dom,html,first,prev,next,last){ var pagenumber=$("#"+dom+" span[class=active]").html(); if(count > 5 ) { if(html>1) { $("."+prev+"").attr('disabled', '').attr('style',"opacity:1;"); $('.'+first+"").attr('disabled', '').attr('style',"opacity:1;"); }else{ $("."+prev+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); $("."+first+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); } if(html==count) { $("."+next+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); $("."+last+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); }else{ $("."+next+"").attr('disabled', '').attr('style',"opacity:1;"); $("."+last+"").attr('disabled', '').attr('style',"opacity:1;"); } } var sl=count-1;var last=count; if(pagenumber == sl || pagenumber ==last ) { if(pagenumber==last){ $("."+next+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); $("."+last+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); } if(count > 5 ){ for(var i=count-4,x=2;i<=count;i++,x++) { $("#"+dom+"").children().eq(x).html(i); if(i==pagenumber) { $("#"+dom+" span").removeClass('active'); $("#"+dom+"").children().eq(x).addClass('active'); } } } }else if(pagenumber==1 || pagenumber==2 ) { if(pagenumber==1){ $("."+prev+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); $("."+first+"").attr('disabled', 'true').attr('style',"opacity:0.5;"); } if(count > 5 ){ for(var i=1,x=2;i<=5;i++,x++) { $("#"+dom+"").children().eq(x).html(i); if(i==pagenumber) { $("#"+dom+" span").removeClass('active'); $("#"+dom+"").children().eq(x).addClass('active'); } } } }else { var start;var end; start=pagenumber-2;end=parseInt(pagenumber)+2; for(var i=start,x=2;i<=end;i++,x++) { $("#"+dom+"").children().eq(x).html(i); if(i==pagenumber) { $("#"+dom+" span").removeClass('active'); $("#"+dom+"").children().eq(x).addClass('active'); } } } } /////////////////////Five click functions needs to write :- var dom="listpages",firstp="first",prevp="previous",nextp="next",lastp="last";var count;var html; function datacall(url) { $.getJSON(o_url,function(lead_data) { $('.leadlist').html(''); $.each(lead_data, function(i,ldata){ // jsonlist data add to your div // the above function datalist called on each click to update list }); } } $("#leadpages span").not(".previouslead, .nextlead, .firstlead, .lastlead").click(function() { countlead=$("#leadcount").val(); $("#leadpages span").removeClass('active'); $(this).addClass('active'); leadhtml=$(this).html(); pagebyclick(countlead,leaddom,leadhtml,leadfirst,leadprev,leadnext,leadlast); $('.leadlist').html('<img alt="" src="/css/images/loader.gif" style="margin:18px 0 0 450px;">'); var page = $(this).html(); var url='/json.php?query=page='+page; datacall(url); }); $('.first').live("click",function(){ var check=$(this).attr('disabled'); if(check =='true') {}else{ firstpage(dom,lastp,nextp); $('.prospectlist').html('<img alt="" src="/css/images/loader.gif" style="margin:18px 0 0 450px;">'); enq_url='/json.php?page=1'; prospectList(enq_url); $('.previous').attr('disabled', 'true').attr('style',"opacity:0.5;"); $('.first').attr('disabled', 'true').attr('style',"opacity:0.5;"); } }); $('.last').live("click",function(){ var check=$(this).attr('disabled'); if(check =='true') {}else{ count=$("#enqcount").val(); lastpage(dom,firstp,prevp,count); $('.prospectlist').html('<img alt="" src="/css/images/loader.gif" style="margin:18px 0 0 450px;">'); var lastp=$("#prospectpages span[class=next]").prev().html(); enq_url='/json.php?page='+lastp; prospectList(enq_url); $('.next').attr('disabled', 'true').attr('style',"opacity:0.5;"); $('.last').attr('disabled', 'true').attr('style',"opacity:0.5;"); } }); $('.previous').click(function() { var check=$(this).attr('disabled'); if(check =='true') {}else{ count=$("#enqcount").val(); previouspage(dom,count,firstp,prevp,nextp,lastp); $('.prospectlist').html('<img alt="" src="/css/images/loader.gif" style="margin:18px 0 0 450px;">'); var pagenumber =$("#prospectpages span[class=active]").html(); enq_url='/json.php?page='+pagenumber; prospectList(enq_url); if($("#prospectpages span[class=active]").prev().html()=="Prev") { $('.previous').attr('disabled', 'true').attr('style',"opacity:0.5;"); $('.first').attr('disabled', 'true').attr('style',"opacity:0.5;"); } } }); $('.next').click(function() { var check=$(this).attr('disabled'); if(check =='true') {}else{ count=$("#enqcount").val(); nextpage(dom,count,firstp,prevp,nextp,lastp); $('.prospectlist').html('<img alt="" src="/css/images/loader.gif" style="margin:18px 0 0 450px;">'); var pagenumber =$("#prospectpages span[class=active]").html(); enq_url='/json.php?page='+pagenumber; prospectList(enq_url); if($("#prospectpages span[class=active]").next().html()=="Next") { $(".next").attr('disabled', 'true').attr('style',"opacity:0.5;"); $(".last").attr('disabled', 'true').attr('style',"opacity:0.5;"); } } }); </script> ///////////////////// now on test.php <div class="leadlist stable"> // div/area containing list </div> <div id="listpages"> <?php $per_page = 10 ; $add=0; $nt= date('Y-m-d H:i:s', strtotime('+7 days')); $selectLead = "query"; $resultleads=mysql_query($selectLead); $countleads = mysql_num_rows($resultleads); if($countleads < $per_page) { $add=1; }else{ $ex=$countleads%$per_page; if($ex < 10 && $ex!=0) { $add=1; }else {$add=0;} } $leadpages =floor($countleads/$per_page); $leadpages=$leadpages+$add; if($leadpages > 5){?> <span class="first>First</span> <span class="previous">Prev</span> <?php for($i=1;$i<=5; $i++){ if($i==1){ ?> <span class="active"><?php echo $i; ?></span><?php }else{ ?> <span><?php echo $i; ?></span> <?php } }?> <span class="next">Next</span> <span class="last">Last</span> <?php }else if($leadpages <= 5){?> <span class="first" disabled="true" style="opacity:0.5;">First</span> <span class="previous" disabled="true" style="opacity:0.5;">Prev</span> <?php for($i=1;$i<=$leadpages; $i++){ if($i==1){ ?> <span class="active"><?php echo $i; ?></span><?php }else{?> <span ><?php echo $i; ?></span> <?php } }?><span class="next" disabled="true" style="opacity:0.5;">Next</span> <span class="last" disabled="true" style="opacity:0.5;">Last</span> <?php } ?>
  6. i used jquery to do the same.. if wanna do tell me..
  7. need pdf library for pdf output.....!
  8. now for pdf , $sql = "SELECT * FROM table"; $rec = mysql_query($sql) or die (mysql_error()); $row = mysql_fetch_row($rec); $filename ="salereport.pdf"; $contents = $row[0]." \t ".$row[1]." \t ".$row[2]." \t \n"; header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename='.$filename); echo $contents; the same code for pdf, its creating pdf file with decode error to open. How to solve this?
  9. OK thank you phppaper, $sql = "SELECT * FROM tablename"; $rec = mysql_query($sql) or die (mysql_error()); $row = mysql_fetch_row($rec); $filename ="excelreport.xls"; $contents = $row[0]." \t ".$row[1]." \t ".$row[2]." \t \n"; header('Content-type: application/ms-excel'); header('Content-Disposition: attachment; filename='.$filename); echo $contents; its giving me what i am looking for since morning today, thank you once again. let me see formatting of excel sheet, and pdf output
  10. Hi all, I wanted to generate report in excel from data in mysql on button click, so what are the ways we can use to do that?
  11. http://php.net/manual/en/function.mysql-insert-id.php mysql_insert_id ([ resource $link_identifier ] ) Retrieves the ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT). ie unique id required and it will solve problem.
  12. after addition of one row use maxid in select query will gives you id of an currently added record.
  13. $comingSundayDate = date('Y-m-d', strtotime('next Sunday')); used in php to get coming sunday curdate in mysql try later .. closing for now.
  14. Hello All, i have dates stored with date data type in mysqladmin, i want last 30 rows between coming Sunday to previous 30 days, i am unable to cal coming Sunday in query i am doing, $query = "select * from table where DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date ORDER BY date Asc"; here in place of current date i want coming Sunday. Plz help!
  15. thank you very much Muddy !, Actually i figured out there we put $var = $_GET['arrayname']; if we echo it $var it gives val1,val2, val3 and so on then to remove ',' and again to compare with another array i used explode which gives me array, hence solved! Thank you very much.
  16. hi all, mine http call : <script type="text/javascript"> var leadidarray =new Array(); leadidarray[1] = 100; leadidarray[2] = 200; leadidarray[3] = 300; leadidarray[4] = 400; leadidarray[5] = 500; var url = 'test.php?query=test&leadarray='+leadidarray; $.getJSON(url,function(data){}); <script> Now on the processing page i am getting $row = $_GET[leadarray] ; var_dump($_GET[leadarray]); or print_r( $_GET[leadarray] ); gives me values 100,200,300,400,500 but i want all that separate variables or all values in array so i can compare with another array, how can i do that?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.