php

  1. S

    SUM value in array PHP

    I have a problem with array. I want to sum up the given quantities (qty). I want to get: blyszczaca Normal = 6; czapkoszal Normal = 6; czapkoszal Luxury = 2; etola Wolf = 1; etola Normal = 2; from this array. Can you help me please? I think about it for the last 4 hours and nothing. Still...
  2. R

    Get specific div when clicking button in php while loop

    I have a while loop spitting out multiple post which each has a div button called 'flag_btn', when clicked I am trying to show the corresponding div container for my form all being displayed from a PHP while loop - $sql = "SELECT * FROM table"; $result = $conn->query($sql); if...
  3. Z

    How do you log a login failure in Symfony 4?

    My Question What sort of Response should I return that won't change the default response? Or is there a better way to tack on a logger to a Login Failure/badcredentialsexception? Details I found this post here which states that you can (in Symfony 2.4) customize authentication failures or...
  4. M

    Laravel A non-numeric value encountered on functions

    What is the reason for the following error in code? The first time runs without problems, But the second time "A non-numeric value encountered" error occurs: public function checkName(string $name, string $path, string $extension, int $num) { if (Storage::exists("$path/$name"))...
  5. B

    How to count all nodes in DOMDocument

    Using PHP 7.1 I want to count the number of nodes in the root of this string: <p>Lorem</p> <p>Ipsum</p> <div>Dolores</div> <b>Amet</b> Using following PHP: $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->loadHTML($content); $root = $dom->documentElement; $children =...
  6. P

    Removing parts of a multidimensional array in PHP

    I have this array $data : Array ( [0] => 86086 [1] => Arnel [2] => Paras ) Array ( [0] => 86085 [1] => Arnely [2] => Para ) Array ( [0] => ) How do i remove the bottom array that contains no values totally so it only contains : Array ( [0] => 86086 [1] =>...
  7. S

    Can I have a Laravel 4.2 blade include with it's own controller?

    I have a sidebar include file that is present on every page of the website I am working on. layout.blade: <div class="after-login buying-process-wrapper"> <!--page content--> {{ $content }} <!-- end of page content--> <!-- Sidebar --> @include('layout.sidebar') <!-- End of Sidebar...
  8. W

    Ajax XHR returns 500 error, but the PHP file works

    index.html (returns 500 error when running this ajax request) function checkUnread(username) { $.ajax( { type: "POST", url: "http://www.projecttranslation.org/cvlgbt/www/web/unreadcount.php", data: { user: username }, cache: true, success: function ( data ) {...
  9. B

    Auto complete processing orders based on their total amount in Woocommerce 3

    In Woocommerce, I am trying to auto complete processing orders based on their total amount. For the moment I have this code that is auto-completing all orders with processing status: add_action( 'init', 'auto_update_orders_status_from_processing_to_completed' ); function...
  10. L

    Notice: Trying to get property of non-object in /wp-content/themes/my-theme/header.php on line 277

    The code below is used to display a random banner image if you are on the page Services, or if you are of a child page of page id 1531, 1567 or 1533. However, when I hit a page not found on a site I get the error mentioned in the title of this question above the banner image. Below is the code...
  11. D

    Adding custom text to the variation price in Woocommerce

    I thought this would have been easy, but I am stuck. All I am trying to do is add the word each after the variation price on a product page. The solution I have found adds it on the category page and in two places on the product page. The code is: /* Adds a text Each - after price */ function...
  12. S

    Custom Page Titles and Descriptions on WooCommerce Category Pages

    I have used Advanced Custom Fields to add a custom page title field on all of my pages, posts, categories and products. In order to remove the default <title> tag and ensure this field pulls through correctly, I have used the following function inside my functions.php file: /* Remove Default...
  13. P

    Include a php variable in json schema data - wordpress site - invalid json error

    <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "LocalBusiness", "name": "storename", "image": "https://staticqa.store.com/wp-content/themes/faf/images/store-logo.png", "@id": '.json_encode($storeid)'., "url": "", "telephone"...
  14. B

    Display Specific data using Ajax and jquery and html select button

    hello community i need help on this what i really want to do is to select from database using onchange() function through Ajax.then return the result to the client.i used Ajax to send the information to the server side and but i am having problem return it with the where condition //this is the...
  15. V

    Get data from two tables and collect them in array and count rows of one table result

    I had two tables named fixture_list and OneRecord where fixture_list has 3 columns named Team1, Team2, player whereas OneRecord has columns like Team1, Team2, id, status so here I want to select all the data of fixture_list and put them into array whereas I want to count the number of rows based...
  16. K

    Calculating Median of an array in PHP

    I'm trying to figure out how to calculate the median of an array of randomly generated numbers. I have the array all set up, but I'm having trouble putting together a function for the calcuation. This is what I have so far: //array $lessFifty = array(); $moreFifty = array(); //number generation...
  17. M

    How to separate json object array received from php?

    I need to separate the 3 php objects arrays after json receiving them. Php code: $row = array(array($directionsStart),array($directionsEnd),$directionsWaypointArray); echo json_encode($row); the output of php: [["Belo Horizonte, Minas Gerais"],["Maric\u00e1, Rio de Janeiro"],["Monte Mor...
  18. D

    Trying to echo an image in Php, cant find src

    i just started learning Php, right now im trying to convert a HTML page to a Wordpress Theme. I have trouble trying to display images... In my HTML page i have imgs like: <img class="mainlogoclean" src="images/akbarlogoclean.png"/> When i tried to change it with php my page just stop working...
  19. W

    I am unsure what kind of loop to use in php

    I am newer to PHP and I am able to get the desired output but I am doing it one index position at a time. I am returning data from a .txt file and I need to insert this data into an HTML table I am creating using PHP. BUT FIRST I need to be able to get the same output without typing out every...
  20. J

    Selecting Data from data base SQL

    I am selecting a data from the database, I can't seem to find the error $check = DB::select("select * from accounts where username = ".$data['username']); ERROR STATED:
Top