Jump to content

budimir

Members
  • Posts

    522
  • Joined

  • Last visited

About budimir

  • Birthday 09/25/1980

Profile Information

  • Gender
    Male
  • Location
    Croatia

Contact Methods

  • Skype
    budimir.skrtic

budimir's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

1

Community Answers

  1. Thank you for the help. I found a problem. Thank you very much.
  2. Hey Guru, Thanks for you're suggestion. This is error I get: Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Commands out of sync; you can't run this command now' in C:\wamp\www\pma\calculation\custom_based_method.php on line 159 What does that mean and how to trace it?
  3. Can someone explain why prepared statement in example below is failing while mysqli_query is working without any problem with exactly same set of data? I tried everything I could figure out and can't see the reason why it is happening. //Now we get costs in% and absolute $number = 0; $numberText = ""; $numberName = ""; $total_costs = 0; $total_costs_abs = 0; foreach($cost_array as $key => $value){ //Here we select only costs with % so we could calculate percentage if(strcmp($value["cost_measure"],"Percent") === 0){ //$number .= getPercentOfNumber($local,$value["cost_amount"])."<br>"; $number = getPercentOfNumber($local,$value["cost_amount"]); //$numberText.= $value["cost_amount"]." %<br>"; $numberText = $value["cost_amount"]; //$numberName .= "cost_name ".$value["cost_name"]."<br>"; $numberName = $value["cost_name"]; //Total value of all percentage costs $total_costs += $number; //Insert calculated costs in DB //Not working if ($stmt = $conn_mysqli -> prepare("INSERT INTO calculations_cost (calculation_id, costs_id, user_id, cost_time, original_number, cost_amount, cost_measure, calculated_cost, cost_name) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)")) { $stmt -> bind_param("iiissssss", $calculation_id, $costs_id, $user_id, $create_time, $local, $numberText, $measure, $number, $numberName); $stmt -> execute(); $stmt -> close(); } //Working $sql = "INSERT INTO calculations_cost (calculation_id, costs_id, user_id, cost_time, original_number, cost_amount, cost_measure, calculated_cost, cost_name) VALUES ('$calculation_id', '$costs_id', '$user_id', '$create_time', '$local', '$numberText', '".$value['cost_measure']."', '$number', '$numberName')"; mysqli_query($mysqli,$sql) or die (mysqli_error($mysqli)); echo $sql."<br>"; //echo "Total costs: $total_costs<br>"; } }
  4. Thank you Psycho! You're code helped me to find my problem and get the value.
  5. I have tried that, but I can't get the value of select box.
  6. Hi, I have a radio button which, when clicked, is opening select. I would like to store the value of a radio and select into two separate cookies. This is my code I'm using, but I can't get second on change event to fire and get the value of select. I do get value of radio and store in cookie, but when trying to get value from select I get null. Can you, please help me and tell me what I'm doing wrong? Html code: <div class="row"> <div class="col-md-6"> <div class="radio clip-radio radio-primary"> <input type="radio" id="radio3" name="vertical" value="Pricelist" /> <label for="radio3"> Pricelist </label> </div> <div id="Pricelist" class="desc"> <div class="form-group"> <select class="cs-select cs-skin-elastic" name="pricelist" id="pricelist_select"> <option value="" disabled selected>Select pricelist</option> <option value="1">1</option> <option value="2">2</option> </select> </div> </div> jQuery //Displaying select box when type radio button is clicked $(document).ready(function() { $("input[name=vertical]").on( "change", function() { var test = $(this).val(); $(".desc").hide(); $("#"+test).show(); $("#pricelist_select").val(); $('#pricelist_select').trigger("change"); alert($("#pricelist_select").find(":selected").val()); $.cookie('pricelist_select', $("#pricelist_select").val()); } ); }); CSS .desc { display: none; }
  7. For some reason I can't get it to work. Could you give me an example how to get cookie value and display it to see the value?
  8. I'm using PHP to view cookie value, but obivously it's not working properly. <?php echo "$COOKIE['calc']"; ?> What javascript code would be to see cookie value in real time (without refreshing page)?
  9. Oh, OK. Now I can see that cookie immediatly gets new value, but the page is not displaying it when I go to second step. What do I need to do to get the value at the same moment when I get to second step?
  10. Yes, I can see it. It is created. It doesn't say any time when is created, but I can see it is created when radio is selected.
  11. Yes, I can see value which is displaying. For example I select Cost and click to go to second step and there I can see it's displaying Cost, but when I go back to first step and select Customer and again go to second step the value didn't change from Cost. Strange thing is that I need to hit F5 and refresh browser exactly two times for new selection to work. I mean I hit F5 twice then make a new selection go to step two and I can see my new selection. Same thing is hapening all the time? Do you have any idea why I need to refresh two times so I could get my new value?
  12. Hi everyone, I'm strugling with javascript and updating cookie value, so I would like to ask for some help. I'm using bootstrap wizard and offer user some options to select. I would like to store that choice into cookie, but the problem I'm runing into is when user clicks on Cost and clicks Next on second step and then he decides to go back and make antoher choice and he chooses Custom, cookie is not updated with new value. I have to refresh page for couple of times before cookie changes it's value. Below is my code I'm using to update and remove cookie so please help me and clarify me why cookie is not updated without refreshing screen for couple of times??? <script type='text/javascript'> $('input:radio').on('change', function() { if ($(this).val() === "Cost") { $.cookie('calc', 'Cost') } else { $.removeCookie('calc', { path: '/' }); } if ($(this).val() === "Competition") { $.cookie('calc', 'Competition') } else { $.removeCookie('calc', { path: '/' }); } if ($(this).val() === "Customer") { $.cookie('calc', 'Customer') } else { $.removeCookie('calc', { path: '/' }); } if ($(this).val() === "Custom") { $.cookie('calc', 'Custom') } else { $.removeCookie('calc', { path: '/' }); } }); </script>
  13. Ok, I managed to figure out that this part of code is blocking it: CKEDITOR.instances."editor2".on('blur', function(){CKEDITOR.instances."editor2".updateElement();}); It is used for updating textarea on input and before submiting form. Why is it blocking validation?
  14. I need you're help with jquery form validation. I have been using jguery form validation but when I have included ckeditor on the page validation stopped working. I can't figure out why. I'm not very good with javascript so it's hard for me to figure out what is blocking it. Html form I'm using is: <form action="save_costs.php" method="POST" role="form" id="form2"> <div class="row"> <div class="col-md-12"> <div class="errorHandler alert alert-danger no-display"> <i class="fa fa-times-sign"></i> You have some form errors. Please check below. </div> <div class="successHandler alert alert-success no-display"> <i class="fa fa-ok"></i> Your form validation is successful! </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Name"; } else if ($_SESSION['language'] == "Croatian") { echo "Naziv"; } ?> <span class="symbol required"></span> </label> <input type="text" placeholder="Insert name" class="form-control" id="name" name="name" /> </div> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Description"; } else if ($_SESSION['language'] == "Croatian") { echo "Opis"; } ?> <span class="symbol required"></span> </label> <input type="text" placeholder="Insert description" class="form-control" id="description" name="description" /> </div> </div> <div class="col-md-6"> <div class="row"> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="control-label"> <?php if ($_SESSION['language'] == "English") { echo "Comments"; } else if ($_SESSION['language'] == "Croatian") { echo "Komentari"; } ?> </label> <textarea class="ckeditor form-control" id="editor2" name="comment" cols="10" rows="10"></textarea> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div> <span class="symbol required"></span><?php if ($_SESSION['language'] == "English") { echo "Required Fields"; } else if ($_SESSION['language'] == "Croatian") { echo "Obavezna polja"; } ?> <hr /> </div> </div> </div> <div class="row"> <div class="col-md-8"> </div> <div class="col-md-4"> <button class="btn btn-primary btn-wide pull-right" type="submit"> <?php if ($_SESSION['language'] == "English") { echo "Submit"; } else if ($_SESSION['language'] == "Croatian") { echo "Spremi"; } ?> <i class="fa fa-arrow-circle-right"></i> </button> </div> </div> </form> Javascript file is attached. This is how I initalise form validation and CKeditor. <script src="../vendor/jquery/jquery.min.js"></script> <script src="../vendor/jquery-validation/jquery.validate.min.js"></script> <script src="../vendor/ckeditor/ckeditor.js"></script> <script src="../vendor/ckeditor/adapters/jquery.js"></script> <script src="../items/js/article_validation.js"></script> <script> <script> jQuery(document).ready(function() { Main.init(); FormValidator.init(); CKEDITOR.instances."editor2".on('blur', function(){CKEDITOR.instances."editor2".updateElement();}); }); </script> Can you, please, help me? I tried everything I thought it could block it. I don't know what to do anymore.
×
×
  • 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.