Jump to content

piyush23424

Members
  • Posts

    76
  • Joined

  • Last visited

About piyush23424

  • Birthday 01/04/1986

Contact Methods

  • MSN
    piyush_sfgroup@hotmail.com

Profile Information

  • Gender
    Male
  • Location
    india

piyush23424's Achievements

Member

Member (2/5)

0

Reputation

  1. I am using the dragdrop functionality on a page which also updates the database.Drag and drop is working fine But i am having difficulty to determine which events to use to update the database. Here is my code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Sortable - Portlets</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <!--<link rel="stylesheet" href="/resources/demos/style.css">--> <style> body { min-width: 520px; } .interview-questions-column { width: 400px; float: left; padding-bottom: 100px; } .question-bank { width: 500px; float: left; padding-bottom: 100px; } .portlet { margin: 0 1em 1em 0; padding: 0.3em; } .portlet-header { padding: 0.2em 0.3em; margin-bottom: 0.5em; position: relative; } .portlet-toggle { position: absolute; top: 50%; right: 0; margin-top: -8px; } .portlet-content { padding: 0.4em; } .portlet-placeholder { border: 1px dotted black; margin: 0 1em 1em 0; height: 50px; } .sortable { border: 1px solid #eee; width: 95%; min-height: 20px; list-style-type: none; margin: 0; padding: 5px 0 0 0; float: left; margin-right: 10px; } .sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 95%; } .bank-quertion-sotrable { border: 1px solid #eee; width: 150px; min-height: 20px; list-style-type: none; margin: 0; padding: 5px 0 0 0; float: left; margin-right: 10px; } .bank-quertion-sotrable li{ margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 200px; } .ui-state-default { height: 1.5em; line-height: 1.2em; } </style> <script> $(function() { $( ".interview-questions-column" ).sortable({ connectWith: ".interview-questions-column", handle: ".portlet-header", cancel: ".portlet-toggle", placeholder: "portlet-placeholder ui-corner-all" }); $( ".portlet" ) .addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) .find( ".portlet-header" ) .addClass( "ui-widget-header ui-corner-all" ) .prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>"); $( ".portlet-toggle" ).click(function() { var icon = $( this ); icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" ); icon.closest( ".portlet" ).find( ".portlet-content" ).toggle(); }); }); $(function() { $( ".sortable" ).sortable({ placeholder: "ui-state-default", connectWith: ".connectedSortable", /*receive: function(event, ui) { // only perform for sub drop downs if($(this).hasClass('question_bank')) { // if the item doesn't have the matching sub class if (!$(this).hasClass($(ui.item).attr('class'))) { // cancel the sortable $(ui.sender).sortable('cancel'); } } alert('receive'); alert(ui.sender.attr("dataid")); alert(ui.sender.toSource()); // alert("[" + this.id + "] received [" + ui.item.attr("id") + "] from [" + ui.sender.attr("id") + "]"); },*/ update: function (event, ui) { //serial = $('#sortableF').sortable('serialize'); var data = $(this).sortable('serialize'); alert(data); //alert('update sortable'); //alert("[" + this.id + "] received [" + ui.item.attr("id") + "] from [" + ui.sender.attr("id") + "]"); // POST to server using $.post or $.ajax /*$.ajax({ data: 'test', type: 'POST', url: '/your/url/here' });*/ } }).disableSelection(); }); $(function() { $( ".draggable" ).draggable({ connectToSortable: ".sortable", helper: "clone", /*revert: function(valid) { if(valid) { alert("drop is valid"); //Dropped in a valid location } else { alert("drop is invalid"); //Dropped in an invalid location } // return !valid; return false; }*/ stop: function( event, ui ) { // alert(ui); // alert("[" + this.id + "] received [" + ui.item.attr("id") + "] from [" + ui.sender.attr("id") + "]"); } }); }); $( "ul, li" ).disableSelection(); </script> </head> <body> <div class="interview-questions-column"> <div class="portlet"> <div class="portlet-header">Feeds</div> <div class="portlet-content"> <ul id="sortableF" class="connectedSortable sortable"> <li class="ui-state-default" id="item-1">Item 1</li> <li class="ui-state-default" id="item-2">Item 2</li> <li class="ui-state-default" id="item-3">Item 3</li> <li class="ui-state-default" id="item-4">Item 4</li> <li class="ui-state-default" id="item-5">Item 5</li> </ul> </div> </div> <div class="portlet"> <div class="portlet-header">News</div> <div class="portlet-content"> <ul id="sortableS" class="connectedSortable sortable"> <li class="ui-state-default" id="item-6">Item 1</li> <li class="ui-state-default" id="item-7">Item 2</li> <li class="ui-state-default" id="item-8">Item 3</li> <li class="ui-state-default" id="item-9">Item 4</li> <li class="ui-state-default" id="item-10">Item 5</li> </ul> </div> </div> <div class="portlet"> <div class="portlet-header">Shopping</div> <div class="portlet-content"> <ul id="sortableS" class="connectedSortable sortable"> <li class="ui-state-default" id="item-11">Item 1</li> <li class="ui-state-default" id="item-12">Item 2</li> <li class="ui-state-default" id="item-13">Item 3</li> <li class="ui-state-default" id="item-14">Item 4</li> <li class="ui-state-default" id="item-15">Item 5</li> </ul> </div> </div> <div class="portlet"> <div class="portlet-header">Links</div> <div class="portlet-content"> <ul id="sortableS" class="connectedSortable sortable"> <li class="ui-state-default" id="item-16">Item 1</li> <li class="ui-state-default" id="item-17">Item 2</li> <li class="ui-state-default" id="item-18">Item 3</li> <li class="ui-state-default" id="item-19">Item 4</li> <li class="ui-state-default" id="item-20">Item 5</li> </ul> </div> </div> <div class="portlet"> <div class="portlet-header">Images</div> <div class="portlet-content"> <ul id="sortableS" class="connectedSortable sortable"> <li class="ui-state-default" id="item-21">Item 1</li> <li class="ui-state-default" id="item-22">Item 2</li> <li class="ui-state-default" id="item-23">Item 3</li> <li class="ui-state-default" id="item-24">Item 4</li> <li class="ui-state-default" id="item-25">Item 5</li> </ul> </div> </div> </div> <div class="question-bank"> <div class="portlet"> <div class="portlet-header">Question bank</div> <div class="portlet-content"> <ul id="question_back" class="connectedSortable bank-quertion-sotrable"> <li class="ui-state-default draggable" id="item-26">Item 1</li> <li class="ui-state-default draggable" id="item-27">Item 2</li> <li class="ui-state-default draggable" id="item-28">Item 3</li> <li class="ui-state-default draggable" id="item-29">Item 4</li> <li class="ui-state-default draggable" id="item-30">Item 5</li> </ul> </div> </div> </div> </body> </html> Basically above code will form few boxes with items(which are actually questions) in it. There is one box on the right side with heading "Question Bank". From the "Question Bank" we can drag the questions to other boxes but can't do the reverse(this is also working). Also we can sort the questions within the box or drag the questions from one box to another. Box heading are the categories and items are questions associated to that categories. What i need is : Event that updates the database when we drag the questions from "Question Bank" to any box on the left side. Please note Questions in the "Question Bank" are pre created coming from database. Event that updates the database when we sort the questions within the box. Event that updates the database when we drag the question from one box to another box. it should also do the sorting for that two boxes. Event that updates the database when we sort the boxes. Here is the JS Fiddle link jsfiddle.net/6o30rrzx Question Bank is comming on the bottom of the page instead of on the right side any advice and suggestions will be greatly appreciated Thank you for reading this post.
  2. I have comma separated values in table column name cityid(datatype is varchar). Now i want to fetch the records from that table based upon those ids with pattern matching technique eg. cityid has 3,4,5,10,5,60,2 values. Here each id is reference to different cities. i have tried following query but it didn't worked for me $sql = "Select * from table where cityid like %id%" i think we can do it with pattern matching. please help Thanks
  3. Thanks BLaZuRE, your suggestion Worked for me . i was working on this problem from last 3 hours and you just solved it in seconds....Thanks again...
  4. I want to replace the static array with dynamic array created by while loop.
  5. Hi, I am working on creating excel sheet with php but i am getting difficulites in inserting dynamic array in the main array. Main array starts from $sheet1. The first array inside the main array are heading of the excel sheet. and the array having values like tes1, test2 etc are the values of excel sheet. If i use the static values then it works fine. but i want to make it dynamic with database values(see the while loop). Pls help me to insert the array created by while at the place of test values array. Thanks while($row = mysql_fetch_array($res)) { array("test","test1", "test2","test4", "test5", "test6", "test7","test8","test9"); } //print_r($string); //$string = implode(",",$string); $sheet1 = array( array('Customer\´s Name','Customer E-mail Address','Customer Address 1','Customer Address 2','Billing City Name', 'Customer\´s Billing State', 'Customer\´s Postal Code', 'Country', 'Customer´s Phone Number'), array("test","test1", "test2","test4", "test5", "test6", "test7","test8","test9"), array("test","test1", "test2","test4", "test5", "test6", "test7","test8","test9"), array("test","test1", "test2","test4", "test5", "test6", "test7","test8","test9"), array("test","test1", "test2","test4", "test5", "test6", "test7","test8","test9"), );
  6. I have found the solution of this problem... We can do this using LIKE statement. $day = 05; $qry = "select * from table_name where date LIKE '%-%-$day'"; Thats it.
  7. Hi, pls read carefully. I want to fetch data from database for a particular day occurrence in month, year. eg. if i query the database with 5. Then it should fetch all the records added on day 5th day of the month, doesn't matter whatever the month is and year. Just wanted all the records added on 5th day of any month-year in database. Note: date field is saved as date(datatype) in database Pls write a query to fetch data for this problem. Pls Reply. Thanks in advance
  8. Thanks Barand and ..... thanks for solving my problem. You guys are just great
  9. hi, i am requesting bookrenter.com with curl and getting back a response in something like xml format The response is <response> <book> <info> <isbn13>9780324786453</isbn13> <isbn10>032478645X</isbn10> </info> <prices> <rental_price days="45">$17.43</rental_price> <rental_price days="90">$24.35</rental_price> <rental_price days="60">$20.87</rental_price> <rental_price days="30">$15.87</rental_price> <rental_price days="125">$28.99</rental_price> </prices> <lowest_shipping_price>$0.00</lowest_shipping_price> <availability>In Stock</availability> <url>http://www.shareasale.com/r.cfm?u=&b=96706&m=14293&urllink=www.bookrenter.com%2Fdiscovering-computers-2010-living-in-a-digital-world-complete-shelly-cashman-series-032478645X-9780324786453</url> </book> </response> Now i want to process the response so that it will show the values in user readable form like 45 day's rent is $17.43 90 day's rent is $24.35 60 day's rent is $20.87 30 day's rent is $15.87 125 day's rent is $28.99 Shipping price is $0.00 plz help Thanks
  10. yes, you are right that only reg exp. can work here I had made a reg. exp for this but it extracts only first element from the string. here is the regular expression. pls, check if you know how to make it work to show all the matching values $pattern = "^\"(.*?)\"^"; preg_match($pattern, $string, $matches); print_r($matches);
  11. i want to extract the values enclosed with inverted commas(quotes) using regular expression. the string is $string = '"6467370","0","1047","","","","","","","","","" "000646737043","999010161661","s802853218509","Test Account","3","9.9500","02/04/2008","99","65","None","4 test test","",""'; reg. exp. should put the extracted values in a array thanks in advance. Thanks
  12. Please have a looking on the code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <title>Untitled Document</title> <script language="JavaScript"> function startWord(strFile) { var myApp = new ActiveXObject("Word.Application"); if (myApp != null) { myApp.Visible = true; myApp.Documents.Open(strFile); } } </script> </head> <body> <a href="javascript:startWord('file:///D:/Piyush/classDox/Classgauge/Queries & Scope.doc')">click Me</a> </body> </html> Objective is to open a file when user clicks the link "click me" Thanks
  13. hello, I have created a .htaccess file as you suggested that is working fine but now it is not linking the css and not even showing any images on the page. I think its because of change in the url here is the code for .htaccess file Options +FollowSymLinks RewriteEngine on RewriteRule buynote/id/(.*)/ buynote.php?id=$1 RewriteRule buynote/id/(.*) buynote.php?id=$1
  14. no, i haven't made any htaccess file because i need this thing only on one page and .htaccess file may disturb the other pages, so i am avoiding to use it. Please tell me if it is possible with php if it is not possible in php then pls explain how can i do this with .htaccess file.
  15. Hi.. Please tell me how to get the id from url if url is like this http://localhost/test.php/id/123 Thanks.
×
×
  • 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.