Jump to content

shashib

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by shashib

  1. any one here ? ..please help me
  2. producttable : id | mid | pid | owgh | nwgh | 1 3 12 1.5 0.6 2 3 12 1.5 0.3 3 3 14 0.6 0.4 4 3 15 1.2 1.1 5 4 16 1.5 1.0 6 4 17 2.4 1.2 7 3 19 3.0 1.4 8 3 19 3.0 1.2 I need result in while loop as **below** : as per mysql query $sql = "SELECT pid,owgh,nwgh from produttable WHERE mid = 3 ";**RESULT I WANT AS BELOW :** Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 12 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 19 3.0 1.2 Tot: 6.0 2.6 $query = mysql_query($sql); echo"<table> <tr> <td> Product Id </td> <td> Old Weight </td> <td> New Wight </td> </tr> "; while($row = mysql_fetch_array($query )){ echo "<tr>"; echo "<td>".$row['pid']."</td>"; echo "<td>".$row['owgh']."</td>"; echo "<td>".$row['nwgh']."</td>"; echo "</tr>"; echo "<tr><td>-----</td> <td>Tot : </td> <td> </td></tr>"; } echo " </table>"; But result i am getting is as below Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 -------------- Tot 12 1.5 0.3 ---------------Tot 14 0.6 0.4 ---------------Tot 15 1.2 1.1 ---------------Tot 19 3.0 1.4 ---------------Tot 19 3.0 1.2which i dont want , **i want as below** : Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 12 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 19 3.0 1.2 Tot: 6.0 2.6 **Update : 27/3/2015**Can i get below result, with sum of each Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 12 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 19 3.0 1.2 Tot: 6.0 2.6**OR** Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 3.0 1.2 Tot: 6.0 2.6 as product id 12, 19 are coming twice hence shown once with its resp valuePlease help me, if i am wrong in HTML tr td format please correct me , it not necessary to get in same table tr,td ..i just want my result in above format
  3. producttable : id | mid | pid | owgh | nwgh | 1 3 12 1.5 0.6 2 3 12 1.5 0.3 3 3 14 0.6 0.4 4 3 15 1.2 1.1 5 4 16 1.5 1.0 6 4 17 2.4 1.2 7 3 19 3.0 1.4 8 3 19 3.0 1.2 I need result in while loop as **below** : as per mysql query $sql = "SELECT pid,owgh,nwgh from produttable WHERE mid = 3 "; **RESULT I WANT AS BELOW :** Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 12 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 19 3.0 1.2 Tot: 6.0 2.6 $query = mysql_query($sql); echo"<table> <tr> <td> Product Id </td> <td> Old Weight </td> <td> New Wight </td> </tr> "; while($row = mysql_fetch_array($query )){ echo "<tr>"; echo "<td>".$row['pid']."</td>"; echo "<td>".$row['owgh']."</td>"; echo "<td>".$row['nwgh']."</td>"; echo "</tr>"; echo "<tr><td>-----</td> <td>Tot : </td> <td> </td></tr>"; } echo " </table>"; But result i am getting is as below Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 -------------- Tot 12 1.5 0.3 ---------------Tot 14 0.6 0.4 ---------------Tot 15 1.2 1.1 ---------------Tot 19 3.0 1.4 ---------------Tot 19 3.0 1.2which i dont want , **i want as below** : Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 12 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 19 3.0 1.2 Tot: 6.0 2.6 **Update : 27/3/2015**Can i get below result, with sum of each Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 12 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 19 3.0 1.2 Tot: 6.0 2.6------------------------------------------Grand Total : 6.3 5 Note in above Old weight : repeat value is not added thats 1.5 , 3.0 is coming twice hence while addition takensingle of it**OR** Product Id | Old weight | New weight --------------------------------------- 12 1.5 0.6 1.5 0.3 Tot: 3.0 0.9 -------------------------------- 14 0.6 0.4 Tot: 0.6 0.4 -------------------------------- 15 1.2 1.1 Tot: 1.2 1.1 -------------------------------- 19 3.0 1.4 3.0 1.2 Tot: 6.0 2.6------------------------------------------ Grand Total : 6.3 5Note in above Old weight : repeat value is not added thats 1.5 , 3.0 is coming twice hence while addition takensingle of it as product id 12, 19 are coming twice hence shown once with its resp valuePlease help me, if i am wrong in HTML tr td format please correct me , it not necessary to get in same table tr,td ..i just want my result in above format
  4. On home page [Website link] there is sliding celebrity Images : on click of any celebrity it takes to it resp. pages which is working on Desktop / laptop browser , i mean click - link working , but same if i open in Any Cell Phones then `sliding images` is shown but `images` is `not click able` and it not going to resp. page of celebrity.I am using `wp-roundabout-pro` ( https://wordpress.org/plugins/wp-roundabout-pro/ ) plugin in my website ( `WordPress 3.8.4` )i know the plugin is not support to current version of my word-press... but In Desktop / laptop browser all working prefect.any idea what is the issue. please help me out... as if this issue is not short-out then my whole work will be wasted Below is plugin code : <?php $anims = array('lazySusan', 'waterWheel', 'figure8', 'square', 'conveyorBeltLeft', 'conveyorBeltRight', 'diagonalRingLeft', 'diagonalRingRight', 'rollerCoaster', 'tearDrop', 'theJuggler', 'goodbyeCruelWorld'); if(!in_array($animation, $anims)){ $animation='conveyorBeltLeft'; $asclass = ''; } else { $asclass = 'class="hideflow"'; } $sid = 'rbt-'.uniqid(); $out = '<ul '.$asclass.' id="'.$sid.'">'; $fwidth = intval($data[opt1]); $fheight = intval($data[opt2]); while($row = mysql_fetch_assoc($res)){ if($row[url]!='' && trim($row[url])!=' '){ $img = '<img src="'.get_image_thumb($row[url], 'w='.$fwidth.'&h='.$fheight).'" />'; } else { $img = ''; } if($row[title]!='' && trim($row[title])!=' '){ //$ttlxz='<span class="rbt-title"><span>'.$row[title].'</span></span>'; $ttlxz=''; } else { $ttlxz=''; } if($row[desc]!='' && trim($row[desc])!=' '){ //$descxz='<span class="rbt-content"><span>'.$row[desc].'</span></span>'; $descxz=''; } else { $descxz=''; } $out = $out.'<li style="background-color:'.$row[color].'">'.$ttlxz.''.$descxz.'<a href='.$row[desc].'>'.$img.'</a></li>'; } $out = $out.'</ul> <style type="text/css"> #'.$sid.' { list-style: none; padding: 0; margin: 0 auto; width: '.$data[opt5].'px; height: '.$data[opt6].'px; } #'.$sid.' .roundabout-moveable-item { height: '.$fheight.'px; width: '.$fwidth.'px; background-color: '.$data[opt4].'; text-align: left; cursor: pointer; overflow:hidden; } </style> <script> jQuery(document).ready(function() { jQuery("#'.$sid.'").roundabout({ autoplay: '.$data[opt7].', autoplayDuration: '.$data[opt9].'000, minOpacity: '.$data[opt10].', maxOpacity: '.$data[opt11].', reflect: '.$data[opt12].', enableDrag: '.$data[opt13].', dragAxis:"'.$data[opt3].'", shape: "'.$animation.'", autoplayPauseOnHover: '.$data[opt8].' }); }); </script> '; ?> Sample of HTML code generated : <div class="slider"> <ul id="rbt-5428f4c10c934" class="hideflow roundabout-holder" style="padding: 0px; position: relative;"> <li style="background-color: rgb(238, 238, 238); position: absolute; left: 684px; top: 58px; width: 137.19px; height: 82.314px; opacity: 0.19; z-index: 117; font-size: 6.4px;" class="roundabout-moveable-item"> <a href="http://www.thefansworld.com/celebfanpage/shahrukh-khan/"> <img src="http://www.thefansworld.com/wp-content/plugins/wp-roundabout-pro/cache/w=300&h=180___Shahrukh-Khan-Magazine-Photoshoot.jpg"> </a> </li> </ul> </div> I taught my a link have some issue but my anchor link is seem to be perfect then why its not working in mobile phones. Also one user told me that on his/her mobile phone its working but i have checked in Samsung , Nokia , Sony ,Tabs all phones ..but its not working -- means image is not clickable ,where on desktop / laptop its working fine
  5. @ above : Your right , but can you help me with its MYSQL QUERY ? (PHP/Mysql ) code .. please
  6. So can you please help me with that code?
  7. Its Just returning simple join query of main and sub packet s and i want : 1 } just need is when i search with id=1 then result will give me it all sub packet and it N sub sub packets,2 } when i search with any sub packet id then it result should give me its sub packet and its n sub packet and so on and on.. also this sub packet is of which main packet and vise versa.**UPDATE :** please check below format for query i need some what N Packet Table Format 1 : thats Main Packet +------------+------------+----------+ | Main Pkt | Sub Packet | COUNT(*) | +------------+------------+----------+ | 01 | 03 | 1 | | 01 | 04 | 1 | | 01 | 05 | 1 | --------------------------------------Second : Table Format 2 : thats Sub and Its N sub Packet +------------+------------+-----------------+ | Main Pkt | Sub Packet | N Sub Packet | +------------+------------+-----------------+ | 01 | 03 | 08 | | 01 | 04 | 06 | | 01 | 04 | 07 | | 01 | 05 | 09 | ---------------------------------------------Third : Table Format 2 : thats Sub and Its N sub Packet +------------+------------+-----------------+ | Main Pkt | Sub Packet | N Sub Packet | +------------+------------+-----------------+ | 01 | 03 | 08 | | 01 | 04 | 06 | | 01 | 04 | 07 | | 03 | 011 | 014 | -- ***** --------------------------------------------- above ***** : here 03 is actually sub packet of 01 hecene it query will also help meSo that 01 - 03 - 011 - 014
  8. I am making packet type system when in my **Packet Table** , parent packet ( `id` which is primary key ) and its N -Sub Packet is under (`parent_id`) is stored , below is my table structure :**Packet_table** id | packet_name | parent_id | 1 | 01 | 0 2 | 02 | 0 3 | 03 | 1 4 | 04 | 1 5 | 05 | 1 6 | 06 | 4 7 | 07 | 4 8 | 08 | 3 9 | 09 | 5 10 | 010 | 2 ........................so on and on with N packets in same table Below is what i have tried *but its not getting* `id` N sub packet detail properly: SELECT p.`packet_name` AS MAIN, s.`packet_name` AS SUB FROM packet_table s LEFT JOIN packet_table p ON s.`parent_id` = p.`id`thats as per above table : **id** ( which is primary / auto increment )id = 1 -> main packet (01) , its sub and N sub packets are :01 - > 03,04,0504 -> 06,0703 -> 0805 -> 09 **in short** 01 -> 03 -> 08 04 -> 06 , 07 05 -> 09 its not necessary above design format mysql code .. just simple N sub packet query will doabove is just few but in my case there will be N number of sub packet for each (id).So how it be can achieve .Note : it can be same as Category and N sub Category type
  9. Hey your correct .. its happening same here ... So what is the solution for this ?
  10. I am struggling from past 2 hours .Tried : location.reload(); reset form many features but after i close my popup and when reopen or open some another id ..my previous id data is still seen there and its continuous for all id. style : #overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; filter:alpha(opacity=70); -moz-opacity:0.7; -khtml-opacity: 0.7; opacity: 0.7; z-index: 100; display: none; } .content a{ text-decoration: none; } .popup{ width: 100%; margin: 0 auto; display: none; position: fixed; z-index: 101; } .content{ min-width: 800px; width: 900px; min-height: 150px; margin: 0px auto; background: #f3f3f3; position: relative; z-index: 103; padding: 10px; border-radius: 5px; box-shadow: 0 2px 5px #000; } .content p{ clear: both; color: #555555; text-align: justify; } .content p a{ color: #d91900; font-weight: bold; } .content .x{ float: right; height: 35px; left: 22px; position: relative; top: -25px; width: 34px; } .content .x:hover{ cursor: pointer; } Jquery / ajax :Below is my popup box + ajax to fetch and show record under Input field $('#class').on('click delegate mouseenter', 'a', function (e) { var data = dt.row( $(this).parents('tr') ).data(); var valuea = data[1]; $(function(){ e.preventDefault(); var table = $('#class').DataTable(); var overlay = $('<div id="overlay"></div>'); $('.close').click(function(){ $('.popup').hide(); overlay.appendTo(document.body).remove(); location.reload(); resetForms(); $("span.ajax_loader").hide(); // success var pathlaser = "server_processing_laser.php"; tablel.clear(); tablel.draw(); tablel.ajax.url(pathlaser).load(); return false; }); $('.xclose').click(function(){ $('.popup').hide(); overlay.appendTo(document.body).remove(); location.reload(); resetForms(); $("span.ajax_loader").hide(); // success var pathlaser = "server_processing_laser.php"; tablel.clear(); tablel.draw(); tablel.ajax.url(pathlaser).load(); return false; }); // POPUP BOX $('.click_'+data[0]+'').click(function(e){e.preventDefault(); overlay.show(); overlay.appendTo(document.body); $('.popup').show(); $("div.note_msg").hide(); $('.popup .id').val(valuea); // FETCHING DATA TO SHOW $.ajax({ type:"GET", url:"fetchrecord.php", data:{ valuea:valuea, }, async: false, success:function(html){ $("#display").after(html); } }); return false; }); }); }); }); **below is popup code :** <div class='popup'> <div class='content'> <a href='' class="xclose"><img src='../datatables/media/images/close.png' alt='quit' class='x' id='x' /> </a> <p> <form method="post" action="" id="feedback_form"> <div class="langtrx_fr" align="center"> <table align="center"> <div id="display"></div> </table> </div> </form> <span class="ajax_loader"></span> <table align="center"><tr><td> <a href='' class='close'><strong>Close</strong></a> </td></tr> </table> </p> </div> </div> fetchrecord.php $valuepktid = $_REQUEST['valuea']; $sql = "SELECT stoneone,stonetwo,stone3,loss FROM stone WHERE pid = ".db_escape($valuepktid)." GROUP BY id"; $resultpkt = mysqli_query($db,$sql); $abpkt = mysqli_fetch_array($resultpkt); ?> <?php header('Pragma: no-cache', true); header("Cache-Control: no-store, no-cache, must-revalidate", true); ?> <tr> <td class="label">Stone 1 :</td> <td class="form"> <input name="stoneone" id="stoneone" readonly value="<?php echo $abpkt['stoneone'];?>" class="stoneone" autocomplete="off" type="number"/> </td> </tr> <tr> <td class="label">Stone 2 :</td> <td class="form"><input name="stonetwo" readonly value="<?php echo $abpkt['stonetwo'];?>" class="stonetwo" autocomplete="off" type="number" /></td> </tr> <tr> <td class="label">Loss :</td> <td class="form"><input name="loss" readonly value="<?php echo $abpkt['loss'];?>" class="loss" value="" autocomplete="off" type="number" /></td> </tr> All is working fine.. i mean i am getting databut when i close and open any other ID , then popup show me above tr/td data twice.means the latest data and the old one which i closed.i tried reload of page so that i get fresh data, but some time its showing me proper data and some time multiple with old one.I think its something related to cache of DIV. which remain as its after close of popup.**popup link :** http://stackoverflow.com/questions/24902935/jquery-datatables-jquery-popup-box-not-working-under-function-php-mysqlany idea please help
  11. yes i can hit php file directly and getting result too .. but @ index.php the outcome is not seen ..also error is in firebug
  12. Hi i am using HTML5 Server-Sent Events Actually i need to show notification ( new record enter and which are unread ) thats when any new record is insert in database ( php / mysql ) So for testing purpose i just tried with count of total row. but getting below error message in my localhost : Firefox can't establish a connection to the server at http://localhost/project/folder/servevent/demo_sse.php.line is : var source = new EventSource("demo_sse.php"); WHAT I HAVE TRIED : index.php <script>if(typeof(EventSource) !== "undefined") {var source = new EventSource("demo_sse.php");source.onmessage = function(event) {document.getElementById("result").innerHTML = event.data;};} else {document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";}</script> <div id="result"></div> demo_sse.php <?phpheader('Content-Type: text/event-stream');header('Cache-Control: no-cache');$db = mysql_connect("localhost", "root", ""); // your host, user, passwordif(!$db) { echo mysql_error(); }$select_db = mysql_select_db("testdatase"); // database nameif(!$select_db) { echo mysql_error(); }$time = " SELECT count( id ) AS ct FROM `product` ";$result = mysql_query($time);$resa = mysql_fetch_assoc($result);echo $resa['ct'];flush();?> please let me know what going wrong. I know for notification we can use Ajax with some interval time , but i don't want such thing. As i have N number of records and which may slow my resources.
  13. I have 4 Column ( id (primary) , a, b ,c ,d ) --------------------------------------------------------------------------------------------------------------------------------ID | A | B | C ( where C = SUM B ) | D ( where D = C / A1 , Where A1 = 6 )-------------------------------------------------------------------------------|------------------------------------------------1 | 4 | 3 | 8 | 22 | 6 | 2 | | 3 | 1 | 3 | | -------------------------------------------------------------------------------|-------------------------------------------------- How i can display such table with pagination . Both A , B value are Input text Field , which entry are made by user side and its stored in Database table , but C value is addition of B (TOTAL) . where C = SUM B where D = C / A1 , Where A1 = 6 HENCE how i can get C,D as A,B coloumn get increment , and c,d will be calculation of it , hence how i can show such TABLE VIEW with Pagination . note : Not tried any thing , as i am bit confuse how to start
  14. @ Foxy , Its not about creating Plugin... its just creation your own template(single page of your own )... in which i am bit confuse , as how i would split latest 10-12 post as per query structure -- as link provided above in same way. also bit confuse in Photos and Videos for resp. post/tags
  15. I want to make a page where on each **tags** :My page should look alike : http://www.missmalini.com/aamir-khan-2/Above page is coming from http://www.missmalini.com/celebrity-fan-pages/this are categories with **Tags** :I also know that the patten is likeBig Image is First ( **First** latest Post of resp. tag )... then 4 image with title are from **Second** post )and then only title after **sixth** post .. its means they have **divide latest 10-12 post** with this structure..2 } if u see on top ( above Ten Latest Aamir Khan Updates ) there is "**Aamir Khan Full Bio** " which is ***different*** for resp. **tags**.3 } If Scroll Down there is Photos and Videos of resp. celeb ( which is tags or may be category wise )Hence how i can do this ( means how i can make such Own Custom Page code ) can any one let me know.
  16. I have many select insert update query , i have written transaction query but want to know if its safe or some need to be corrected. Also if all is ok i should get successful "Transaction completed successfully!" , but if something get wrong then error message showed be seen and ROLLBACK should be done , but its NOT .... not rollback is done Below is what I have tried. Please let me know if something is wrong: function autocommitfalse(){global $db;return mysqli_autocommit($db, FALSE);}function autocommittrue(){global $db;return mysqli_autocommit($db, TRUE);}function commitquery(){global $db;return mysqli_commit($db);}function rollbackedquery(){global $db;return mysqli_rollback($db);} =============================================================================== try {global $db;autocommitfalse();-----------------$SQLSELECT = "SELECT * FROM BC ";$result_as = mysqli_query($db,$SQLSELECT);$rsfetch = mysql_fetch_array($result_as);if(!$result_as ){throw new Exception('Wrong SQL SELECT: ' . $SQLSELECT. ' Error: '.db_error_msg($db) . db_error_no());}-----------------$sqla ="INSERT INTO A (sd) VALUES ('df') where id=".$rsfetch['dh'];$result_a = mysqli_query($db,$sqla);if(!$result_a){throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());}-----------------$sqlb ="INSERT INTO B (sdds) VALUES ('trtrt') where id=".$rsfetch['dh'];$result_b =mysqli_query($db,$sqlb);if(!$result_{throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());}-----------------$a = mysqli_insert_id($db);-----------------$sqlCb ="UPDATE CB SET A ='NM' where id=".$a ;$result_Cb = mysqli_query($db,$sqlCb);if($result_Cb === false || mysqli_affected_rows($db) == 0 ){throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());}-----------------commitquery();echo 'Transaction completed successfully!';} catch (Exception $e) {echo"<br >";echo "<table align=center><tr><td>";echo $e->getMessage();echo "</td></tr></table>";echo"<br >";echo display_error(_("Transaction failed: transaction rolled back"));rollbackedquery();}autocommittrue(); Please let me know its correct or not , if need to correct then what , as still not rollbacked with above code..
×
×
  • Create New...