Jump to content

Danishhafeez

Members
  • Posts

    41
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Danishhafeez

  1. To create a bottom curve at the top of a div using clip-path, you are on the right track with ellipse. The clip-path property allows you to define a clipping region to restrict the visible portion of an element. .div-with-curve { width: 300px; /* Adjust width as needed */ height: 200px; /* Adjust height as needed */ background-color: #f0f0f0; /* Background color of the div */ clip-path: ellipse(100% 60% at 50% 0%); } In this configuration, the ellipse will be centered horizontally (50%) and positioned at the top edge (0%), creating a curved cutout at the top of the div. The ellipse itself will have a horizontal diameter equal to the width of the div and a vertical diameter 60% of the height of the div. Here’s an example HTML structure to see it in action: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Curved Div</title> <style> .div-with-curve { width: 300px; /* Adjust width as needed */ height: 200px; /* Adjust height as needed */ background-color: #f0f0f0; /* Background color of the div */ clip-path: ellipse(100% 60% at 50% 0%); } </style> </head> <body> <div class="div-with-curve"></div> </body> </html> This CSS snippet will create a curved shape at the top of the div, achieving the effect you described. Adjust the dimensions and positioning values (100%, 60%, 50%, 0%) as necessary to fine-tune the curve according to your design needs. Best Regard Danish Hafeez | QA Assistant https://www.ictinnovations.com https://www.ictbroadcast.com
  2. From your description, it appears that the issue lies in retrieving customers who are not present in the billing table but are in the machine master table. To achieve this, you should use a LEFT JOIN and then filter out the rows where the billing information (CustomerID) is NULL from the billing table. SELECT machine.Branch, machine.Plant, machine.CustomerID, machine.Customername, machine.CustomerCity, machine.CustomerSegment, machine.CustomerType, COALESCE(bill.JanBilling, 0) AS JanBilling, COALESCE(bill.FebBilling, 0) AS FebBilling, COALESCE(bill.MarBilling, 0) AS MarBilling, COALESCE(bill.AprBilling, 0) AS AprBilling, COALESCE(bill.MayBilling, 0) AS MayBilling, COALESCE(bill.JunBilling, 0) AS JunBilling, COALESCE(bill.JulBilling, 0) AS JulBilling, COALESCE(bill.AugBilling, 0) AS AugBilling, COALESCE(bill.SepBilling, 0) AS SepBilling, COALESCE(bill.OctBilling, 0) AS OctBilling, COALESCE(bill.NovBilling, 0) AS NovBilling, COALESCE(bill.DecBilling, 0) AS DecBilling FROM ( SELECT b.branchName AS Branch, c.plantName AS Plant, d.CustomerID AS CustomerID, d.CustomerName AS Customername, d.CustomerCity AS CustomerCity, d.CustomerSegment AS CustomerSegment, d.CustomerType AS CustomerType FROM sbms.machinemaster AS a INNER JOIN sbms.customermaster AS d ON d.CustomerID = a.CustomerID INNER JOIN sbms.branch AS b ON b.branchcode = a.BranchCode INNER JOIN sbms.plant AS c ON c.branchID = b.branchID WHERE a.MachineStatus = 'A' GROUP BY a.CustomerID, b.branchcode ) AS machine LEFT JOIN ( SELECT d.CustomerID AS CustomerID, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-01' THEN gross_amount ELSE 0 END) / 100000 AS JanBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-02' THEN gross_amount ELSE 0 END) / 100000 AS FebBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-03' THEN gross_amount ELSE 0 END) / 100000 AS MarBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-04' THEN gross_amount ELSE 0 END) / 100000 AS AprBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-05' THEN gross_amount ELSE 0 END) / 100000 AS MayBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-06' THEN gross_amount ELSE 0 END) / 100000 AS JunBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-07' THEN gross_amount ELSE 0 END) / 100000 AS JulBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-08' THEN gross_amount ELSE 0 END) / 100000 AS AugBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-09' THEN gross_amount ELSE 0 END) / 100000 AS SepBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-10' THEN gross_amount ELSE 0 END) / 100000 AS OctBilling, SUM(CASE DATE_FORMAT(a.billing_date,'%Y-%m') WHEN '2024-11' THEN gross_amount ELSE 0 END) / 100000 AS NovBilling, SUM(CASE DATE_FORMAT(a.billing_date, Used LEFT JOIN to join machine (from machinemaster) with bill (from billing). Included COALESCE to handle NULL values in billing amounts. Added WHERE bill.CustomerID IS NULL to filter out customers present in machinemaster but not in billing. Make sure to adjust date formats and other specifics (gross_amount division, etc.) based on your actual database schema and requirements. This query should give you a list of customers who are in the machinemaster table for a branch but do not have billing records in the specified months. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  3. To achieve a gradient that transitions from lighter at the top to darker at the bottom on a per-line basis, especially when the text spans multiple lines and is bold, you can utilize the background-clip: text property along with a linear gradient background. .class { color: transparent; /* Hides the original text */ background: linear-gradient(to bottom, #FFFFFF 0%, #CCCCCC 100%); -webkit-background-clip: text; /* For Safari */ background-clip: text; -webkit-text-fill-color: transparent; /* Ensures the text is transparent */ font-weight: bold; /* Optionally, if your text is bold */ } Color and Gradient Setup: color: transparent;: This makes the original text color transparent so that it doesn't show. background: linear-gradient(to bottom, #FFFFFF 0%, #CCCCCC 100%);: Defines a linear gradient that starts with #FFFFFF (white) at the top (0%) and transitions to #CCCCCC (light grey) at the bottom (100%). Background Clip: -webkit-background-clip: text;: Ensures that the background gradient is clipped to the shape of the text. This property is prefixed for compatibility with older versions of Safari. background-clip: text;: Standardized version of background-clip for other browsers. Text Color: -webkit-text-fill-color: transparent;: Ensures the text itself remains transparent so that the gradient background shows through the text. Best Regard Danish hafeez | QA Assistant ICTInnovations
  4. PHPUnit Version Compatibility: The method expectedOutputString() might not be available in the version of PHPUnit you are using (PHPUnit 11.1.3 in your case). PHPUnit evolves over time, and methods can be added, deprecated, or removed between versions. Incorrect Method Name: Double-check the method name expectedOutputString(). In some cases, method names can change slightly between versions or might be case-sensitive. Namespace or Scope Issue: Ensure that you are extending the correct class (PHPUnit\Framework\TestCase for PHPUnit tests) and that your test class is properly set up with the correct namespaces and inheritance. Here’s an example of how expectOutputString() is typically used in PHPUnit tests: use PHPUnit\Framework\TestCase; class OutputTest extends TestCase { public function testOutput() { $expectedOutput = "Expected output"; $this->expectOutputString($expectedOutput); // Perform actions that should produce the expected output echo $expectedOutput; } } Ensure that your test class extends PHPUnit\Framework\TestCase and that your PHPUnit installation is properly set up and accessible within your development environment. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  5. Certainly! You can achieve this by using Python and regular expressions (regex) to clean up your list of questions. Here’s a step-by-step guide on how to remove the square brackets and their contents (including "Question - ...") and the round brackets with their contents (including the page numbers): import re # Example array of questions questions = [ "[Question - Geography Chapter2] How would you describe humans' relationship with the physical environment? (Page 42)", "[Question - Geography Chapter4] What is a natural resource? (Page 67)", "[Question - Geography Chapter3] What are two or three resources which you cannot do without? What are the reasons for your choices? (Page 52)", "[Question - Geography Chapter6] What is the human-centered view on the use of natural resources? (Page 339)", "[Question - Geography Chapter7] What are the benefits of using products with a smaller environmental footprint? (Page 342)" ] # Regex pattern to remove text within square brackets and round brackets pattern = r"\[.*?\]|\(.*?\)" # Function to clean each question def clean_question(question): return re.sub(pattern, "", question).strip() # Clean all questions cleaned_questions = [clean_question(q) for q in questions] # Print cleaned questions for idx, question in enumerate(cleaned_questions, 1): print(f"{idx}. {question}") Regex Pattern: \[.*?\] matches everything inside square brackets, including the brackets themselves. \(.*?\) matches everything inside round brackets, including the brackets themselves. .*? is a non-greedy match to ensure we match the shortest sequence possible within the brackets. Function clean_question: Uses re.sub() to substitute the matched patterns (square and round brackets and their contents) with an empty string "". Cleaning Process: cleaned_questions is a list comprehension that iterates over each question in the questions list, applies the clean_question function, and stores the cleaned question in cleaned_questions. 1. How would you describe humans' relationship with the physical environment? 2. What is a natural resource? 3. What are two or three resources which you cannot do without? What are the reasons for your choices? 4. What is the human-centered view on the use of natural resources? 5. What are the benefits of using products with a smaller environmental footprint? Best Rgeard danish Hafeez | QA Assistant ICTInnovations
  6. es, you can implement several methods to help verify that an email isn't spoofed and that it's from the claimed domain. Here are a few techniques you can use: SPF (Sender Policy Framework): SPF allows the domain owner to specify which mail servers are allowed to send email on behalf of their domain. You can check if the sender's IP address is listed in the SPF record of the claimed domain. DKIM (DomainKeys Identified Mail): DKIM adds a digital signature to the email headers, which can be verified against a public key published in the DNS records of the claimed domain. Best Regard Danish hafeez | QA Assistant ICTInnovations
  7. Here’s how you can achieve that: Separate Logic from Output: Move the output logic outside the core function. Use Dependency Injection: Inject a callable (e.g., a function or a method) that handles the output. This allows you to control the output during testing. <?php function copyFileExample($outputCallback = null) { $verboseText = "Copying file... please wait...\n"; if ($outputCallback) { call_user_func($outputCallback, $verboseText); } // Simulate the file copy with sleep(5) sleep(5); // replaces copy() function return $verboseText; } class FileTest extends PHPUnit\Framework\TestCase { static function copyProvider() { return [ [ "outputCallback" => null // recommended [HIGHLIGHT] ], [ "outputCallback" => function($text) { echo $text; } // not recommended for testing [HIGHLIGHT] ], ]; } /** * @dataProvider copyProvider */ function testCopy($outputCallback) { $expectedOutput = "Copying file... please wait...\n"; ob_start(); $result = copyFileExample($outputCallback); $output = ob_get_clean(); if ($outputCallback) { $this->assertEquals($expectedOutput, $output); } else { $this->assertEquals($expectedOutput, $result); } } } ?> Function Definition: The copyFileExample function now accepts an optional $outputCallback parameter, which can be any callable (function, method, etc.). If $outputCallback is provided, it is called with the verbose text. This decouples the printing logic from the core function. Test Class: The copyProvider method returns different scenarios, including one without any callback and one with a callback that echoes the text. The testCopy method captures any output printed by the callback using output buffering (ob_start, ob_get_clean). The assertions check the output if a callback is provided and the return value otherwise. $ phpunit FileTest.php PHPUnit 10.5.20 by Sebastian Bergmann and contributors. Runtime: PHP 8.1.2-1ubuntu2.17 .. OK (2 tests, 2 assertions) With this approach, both tests should pass, ensuring that the function behaves correctly with and without output, and making it easier to test and maintain. Best Regard Danish hafeez | QA Assistant ICTInnovations
  8. To achieve the desired layout where the image and text columns switch order on smaller screens, you can use CSS Flexbox with media queries. The key is to set the flex direction to column and change the order of the elements within the media query. <div id="flex"> <div id="left"> <img src="image.jpg" alt="Image"> </div> <div id="right"> <p>Your text goes here.</p> </div> </div> Default Styles for Larger Screens: By default, the elements will be displayed side by side (e.g., using Flexbox or Grid). #flex { display: flex; } #left, #right { flex: 1; /* or you can use a specific width like flex: 0 0 50%; */ } #left { order: 1; } #right { order: 2; } Use a media query to change the flex direction to column and adjust the order of the elements. @media only screen and (max-width: 950px) { #flex { display: flex; flex-direction: column; } #left { order: 2; } #right { order: 1; } } display: flex;: Ensures that the parent container uses Flexbox. flex-direction: column;: Stacks the child elements vertically instead of horizontally. order: Adjusts the order of elements. Lower values appear first. In the media query, setting #left to order: 2 and #right to order: 1 swaps their positions. here is complete example: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Responsive Layout</title> <style> /* Default Styles for Larger Screens */ #flex { display: flex; } #left, #right { flex: 1; } #left { order: 1; } #right { order: 2; } /* Styles for Smaller Screens */ @media only screen and (max-width: 950px) { #flex { display: flex; flex-direction: column; } #left { order: 2; } #right { order: 1; } } </style> </head> <body> <div id="flex"> <div id="left"> <img src="image.jpg" alt="Image" style="width: 100%;"> </div> <div id="right"> <p>Your text goes here.</p> </div> </div> </body> </html> Best Regard Danish Hafeez | QA Assistant ICTInnovations
  9. Since PHP 8.3 may have stricter error reporting or handling compared to 8.3.6, this issue might have been silently ignored or handled differently in the previous version. To fix this issue, you should ensure that $forum_id is always set and not an empty string before trying to access $forums['f'][$forum_id]. You can also add a check to make sure the key exists in the array. foreach ($allowed forums as $forum_id) { if (empty($forum_id)) { // Skip this iteration if $forum_id is empty continue; } if (isset($forums['f'][$forum_id])) { $f = $forums['f'][$forum_id]; } else { // Handle the case where $forum_id is not found in $forums['f'] $f = []; // or set a default value, or log an error } $cat_forum['c'][$f['cat_id']][] = $forum_id; if ($f['forum_parent']) { $cat_forum['subforums'][$forum_id] = true; $cat_forum['forums_with_sf'][$f['forum_parent']] = true; } } Check for the existence of the array key using array_key_exists(): foreach ($allowed forums as $forum_id) { if (empty($forum_id)) { // Skip this iteration if $forum_id is empty continue; } if (array_key_exists($forum_id, $forums['f'])) { $f = $forums['f'][$forum_id]; } else { // Handle the case where $forum_id is not found in $forums['f'] $f = []; // or set a default value, or log an error } $cat_forum['c'][$f['cat_id']][] = $forum_id; if ($f['forum_parent']) { $cat_forum['subforums'][$forum_id] = true; $cat_forum['forums_with_sf'][$f['forum_parent']] = true; } } Check for Empty $forum_id: Ensuring $forum_id is not empty helps prevent accessing array keys with empty values. isset() and array_key_exists(): Both functions ensure that the key exists in the array before accessing it. isset() also checks that the value is not null, whereas array_key_exists() strictly checks for the presence of the key regardless of its value. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  10. @GregRickshaw thanks alot for your feedback i am glad as my guidence solve your problem shortly Best Regard Danish hafeez | QA Assistant ICTInnovations
  11. To ensure the dropdown appears in the correct position within each row, you need to place the <select> element inside the loop that iterates over your $details array. The issue arises because the <select> element is currently being added outside the loop, which causes it to appear only once at the end of the table. Additionally, the form tags should also be inside the loop to ensure each row has its own form, dropdown, and submit button. <?php // Connection details section.. $email = current_user(); $statement = db()->prepare("EXEC fe_uspConnectionDetails ?;"); $statement->bindParam(1, $email, PDO::PARAM_STR); $statement->execute(); $details = $statement->fetchAll(PDO::FETCH_ASSOC); // Fetch agencies for dropdown $statement = db()->prepare("EXEC fe_uspAdminUserShowRegisteredAgencies"); $statement->execute(); $agencies = $statement->fetchAll(PDO::FETCH_ASSOC); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <p> <table> <thead> <tr> <th><i>name</i></th> <th><i>email</i></th> <th><i>skill</i></th> <th><i>mobile</i></th> <th><i>region</i></th> <th><i>days</i></th> <th><i><center>refer to</center></i></th> </tr> </thead> <tbody> <?php if ($details) { foreach ($details as $detail) { echo "<tr>"; echo "<td><left>" . $detail['fullname'] . "</td>"; echo "<td><left>" . $detail['connectionemail'] . "</td>"; echo "<td><left>" . $detail['skill'] . "</td>"; echo "<td><left>" . $detail['phonenumber'] . "</td>"; echo "<td><left>" . $detail['region'] . "</td>"; echo "<td><left>" . $detail['daysremaining'] . "</td>"; echo "<td><left>"; echo "<form action='LogReferal.php?email=referto' method='POST'>"; echo "<input type='hidden' name='referred' value='" . $detail['connectionemail'] . "'>"; echo "<select name='referto' id='referto'>"; foreach ($agencies as $agencylist) { echo "<option value='" . $agencylist['email'] . "'>" . $agencylist['email'] . "</option>"; } echo "</select>"; echo "<input type='submit' value='refer'>"; echo "</form>"; echo "</td>"; echo "</tr>"; } } ?> </tbody> </table> </body> </html> Data Fetching: First, fetch both the connection details and the agency list. HTML Structure: The HTML structure now includes the <select> dropdown within each row of the table. Loop and Form: The loop iterates over each $detail and adds a row in the table. The form, including the hidden input for the referred value and the dropdown for referto, is inside this loop. This ensures each row has its own form and dropdown, associated correctly with the row's data. Form Method: Ensure the form uses the POST method to securely send data. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  12. Yes, you can achieve this by creating a single config.php file that defines the base path to your assets. Then, you can include this config.php file in all your PHP scripts to access the styles and other assets. Create the config.php file: Place this file in the TESTFOLDER directory (or any consistent location you prefer). This file will define the base path to your assets. <?php // Define the base URL to your assets define('BASE_URL', '/TESTFOLDER'); ?> Include the config.php file in your scripts: In each of your PHP scripts (index.php, dash.php, 01.php, 02.php), include the config.php file and use the BASE_URL constant to link to your assets. For example, in TESTFOLDER/module1/public/index.php: <?php // Include the config file require_once '../../config.php'; // Adjust the path as needed // Use the BASE_URL constant to link to the CSS file ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="<?php echo BASE_URL; ?>/assets/styles/style.css"> </head> <body> <!-- Your content goes here --> </body> </html> Adjust the path to config.php as necessary: Since the public folder is two levels deep inside the module1 folder, you need to navigate up two levels to include the config.php file. The ../../config.php path in the example above reflects this. Make sure to adjust this path if your structure changes or if the config.php file is located elsewhere. By using this approach, you can centralize the configuration of your asset paths, making your code cleaner and easier to maintain. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  13. Modify the HTML: Add additional countdown containers with unique IDs. Modify the JavaScript: Update the initializeClock function to accept a unique id for each countdown. Update the fetchRoutine function to fetch data for multiple countdowns and initialize clocks accordingly. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Countdown Clock</title> <link rel="stylesheet" href="reset.css"> <link rel="stylesheet" href="countdown.css"> </head> <body> <div class="info"> <h1 id="display_title"></h1> <h2 id="countdown_date"></h2> </div> <div id="countdown_container1" class="countdown-container"> <div id="display_clock1"> <figure class="box"> <div class="days"></div> <figcaption>Days</figcaption> </figure> <figure class="box"> <div class="hours"></div> <figcaption>Hours</figcaption> </figure> <figure class="box"> <div class="minutes"></div> <figcaption>Minutes</figcaption> </figure> <figure class="box"> <div class="seconds"></div> <figcaption>Seconds</figcaption> </figure> </div> </div> <div id="countdown_container2" class="countdown-container"> <!-- Another countdown container can be added here --> </div> <script src="countdown.js"></script> </body> </html> In the JavaScript (countdown.js), you would modify the functions accordingly: const initializeClock = (containerId, clockId, endtime) => { const clock = document.getElementById(clockId); if (!clock) { console.error(`Clock with id '${clockId}' not found.`); return; } const fields = ['days', 'hours', 'minutes', 'seconds'].map(field => clock.querySelector(`.${field}`) ); if (fields.some(element => element === null)) { console.error('One or more clock elements not found:', fields); return; } const updateClock = () => { const { total, days, hours, minutes, seconds } = getTimeRemaining(endtime); [days, hours, minutes, seconds].forEach((val, i) => { fields[i].textContent = String(val).padStart(2, '0'); }); if (total <= 0) { clock.textContent = "Contest Finished, entry time expired"; clearInterval(timeInterval); } }; updateClock(); const timeInterval = setInterval(updateClock, 1000); }; const fetchRoutine = () => { fetch('data.json') .then(response => response.json()) .then(data => { document.getElementById("countdown_date").textContent = data.date_format; document.getElementById("display_title").textContent = data.title; initializeClock("countdown_container1", "display_clock1", new Date(Date.parse(data.time_left))); // Initialize additional countdowns here if needed }) .catch(error => { console.error('Fetch error:', error); }); }; document.addEventListener('DOMContentLoaded', fetchRoutine); With these modifications, you can add multiple countdown containers to your HTML, and the JavaScript will handle initializing countdowns for each container separately based on the fetched data. Best Regard danish Hafeez | QA Assistant https://www.ictinnovations.com https://www.ictbroadcast.com
  14. You can definitely achieve this directly with SQL using the SUM() function along with GROUP BY and ORDER BY. Here's a basic example of how you could structure your SQL query: SELECT SUM(balloons) AS balloons_total, SUM(soda) AS soda_total, SUM(ribbons) AS ribbons_total, SUM(bows) AS bows_total FROM votes GROUP BY balloons, soda, ribbons, bows ORDER BY balloons_total DESC, soda_total DESC, ribbons_total DESC, bows_total DESC; This query will sum up the votes for each item (balloons, soda, ribbons, bows) separately, grouping them by their respective columns, and then order the results in descending order based on the total votes for each item. You don't need to put the summed data into an array and sort it separately in your code; SQL can handle the sorting and aggregation for you. Best Regard Danish hafeez | QA Assistant ICTInnovations
  15. n PHP, to call a static method, you should use the class name directly followed by ::, like ClassName::method(). Non-static methods are called on an instance of the class using the arrow operator (->). Since show() is a static method, you should call it directly from the class without creating an instance of the template class. So your call should look like this: $content = template::show($m1::$m2()); However, your error suggests that $m1::$m2() is not returning a valid class name. Ensure that $m1 is a class name and $m2 is a static method of that class. If you intend to call a static method of a class stored in a variable, you can use call_user_func() or call_user_func_array() like this: $content = call_user_func(array($m1, $m2)); Or directly: $content = $m1::$m2(); Make sure that $m1 holds the name of a class and $m2 holds the name of a static method of that class. Best Regard Danish hafeez | QA Assistant ICTInnovations
  16. It seems like you're almost there! Your code looks good, but there are a few adjustments needed to properly update the countdown timer in your HTML. // Main function to update countdown timer function updateCountdown() { // Calculate the time difference between now and the ending date let difference = endingDate.getTime() - new Date().getTime(); // Check if the difference is valid if (difference <= 0) { console.log("Contest Finished, time expired"); let expiredContest = "Contest Finished, entry time expired"; document.getElementById("expired").textContent = expiredContest; } else { // Calculate days, hours, minutes, and seconds let days = Math.floor(difference / (1000 * 60 * 60 * 24)); let hours = Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); let minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60)); let seconds = Math.floor((difference % (1000 * 60)) / 1000); // Update HTML elements with the calculated values document.getElementById("daysleft").textContent = days; document.getElementById("hoursleft").textContent = hours; document.getElementById("minutesleft").textContent = minutes; document.getElementById("secondsleft").textContent = seconds; // Schedule the next update after 1 second setTimeout(updateCountdown, 1000); } } // Call the updateCountdown function to start the countdown updateCountdown(); With these changes, your countdown timer should update every second, displaying the correct values for days, hours, minutes, and seconds until the contest ends. Let me know if you have any questions or encounter any issues! Best Regard Danish Hafeez | QA Assistant ICTInnovations
  17. If you're encountering issues with $_SERVER['DOCUMENT_ROOT'] not pointing to the correct directory when moving your files to a web server, you might need to adjust your approach. One common method to ensure that your file paths are consistent across different environments is to define a base directory constant in your application. define('BASE_DIR', dirname(__FILE__)); This line of code sets the constant BASE_DIR to the directory of the current script. You can then use this constant to build your file paths reliably: $assets_path = BASE_DIR . '/assets/'; $includes_path = BASE_DIR . '/includes/'; Alternatively, you can use relative paths to access files within your project. For example: $assets_path = 'assets/'; $includes_path = 'includes/'; In either case, once you have the base directory or relative paths defined, you can access files inside subfolders using concatenation: $module1_file = $includes_path . 'module1/module1_subfolder1/file.php'; $module2_file = $includes_path . 'module2/module2_subfolder1/file.php'; i hope This approach should help you maintain consistent file paths across different environments. Best Regard Danish hafeez | QA Assistant https://www.ictinnovations.com https://www.ictbroadcast.com
  18. For storing submitted data, consider a normalized table structure with a JSON column for flexibility in handling dynamic forms. Ensure the JSON data is well-structured to facilitate easy querying and analysis. To handle multiple forms attached to a single pass, include metadata (like form ID or name) with each submission. Use this metadata to separate and store each form's data independently in your database. For dynamic forms, utilize AJAX FormData for submission to accommodate varying field structures. Implement robust server-side validation mechanisms to ensure data integrity and security. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  19. If you've installed XAMPP on your Mint machine, it should be accessible through the terminal. You can launch it by opening a terminal window and typing: sudo /opt/lampp/lampp start This command will start the XAMPP services. If you want to stop XAMPP, you can use: sudo /opt/lampp/lampp stop If you prefer a graphical interface, you can create a desktop shortcut for XAMPP. To do this, follow these steps: Right-click on your desktop and select "Create a new launcher here" or similar. In the command field, enter /opt/lampp/manager-linux-x64.run if you're using a 64-bit system, or /opt/lampp/manager-linux.run if you're using a 32-bit system. Give the launcher a name, such as "XAMPP Control Panel." Save the launcher. i hope Now you should be able to launch XAMPP from your desktop Best Regard Danish hafeez | QA Assistant ICTInnovations
  20. It seems like your application is encountering issues with loading external resources, such as CSS and JavaScript files. Start by checking the network tab in your browser's developer tools for failed requests and reviewing any recent changes to your code or server configuration. Additionally, verify that file paths, URLs, and MIME types are correctly set to ensure proper resource loading. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  21. To dynamically create multiple instances of your emoji selector and text area pair, you can use a loop to generate unique IDs for each pair and then initialize the event listeners accordingly. <!DOCTYPE html> <html> <head> <title>Dynamic Emoji Selector</title> </head> <body> <!-- Add a container where the emoji selector and text area pairs will be added --> <div id="emojiContainer"></div> <!-- Your original emoji selector and text area template --> <select id="emojiSelectTemplate"> <option value="">Select a kaomoji</option> </select> <textarea name="comment_text_template" class="comment_text" rows="2" cols="40" placeholder="Type comment reply here." required></textarea> <script> document.addEventListener('DOMContentLoaded', function() { const emojis = [ '(・ω・)', '(´・ω・`)', '(。♥‿♥。)', 'ヾ(⌐■_■)ノ♪', '(╯°□°)╯︵ ┻━┻' ]; // Get a reference to the emoji container const emojiContainer = document.getElementById('emojiContainer'); // Loop to create multiple instances const numInstances = 30; // Change this to the number of instances you need for (let i = 0; i < numInstances; i++) { // Clone the template elements const emojiSelect = document.getElementById('emojiSelectTemplate').cloneNode(true); const inputText = document.getElementsByClassName('comment_text')[0].cloneNode(true); // Set unique IDs for each instance emojiSelect.id = 'emojiSelect' + i; inputText.id = 'comment_text' + i; // Append cloned elements to the container emojiContainer.appendChild(emojiSelect); emojiContainer.appendChild(inputText); // Populate the select dropdown with emojis emojis.forEach(emoji => { const option = document.createElement('option'); option.value = emoji; option.text = emoji; emojiSelect.appendChild(option); }); // Event listener for emoji selection emojiSelect.addEventListener('change', function() { const selectedEmoji = this.value; if (selectedEmoji) { inputText.value += selectedEmoji; this.selectedIndex = 0; // Reset dropdown to default option after selection } }); } }); </script> </body> </html> In this modified version: I've added a <div> with the id emojiContainer where the dynamic instances of emoji selectors and text areas will be added. The original emoji selector and text area are now considered as templates (with id="emojiSelectTemplate" and class="comment_text" respectively). Inside the loop, I clone the template elements, set unique IDs for each instance, and then append them to the container. Best Regard Danish hafeez | QA Assistant ICTInnovations
  22. To achieve this without dynamically building a query with OR conditions, you can use a JOIN with a LIKE condition. SELECT DISTINCT d.* FROM data d JOIN groupareas ga ON d.areaId = ga.areaId JOIN areas a ON ga.areaId = a.areaId JOIN ( SELECT groupId, GROUP_CONCAT(areaPath) AS areaPaths FROM groupareas ga JOIN areas a ON ga.areaId = a.areaId GROUP BY groupId ) AS grouped_areas ON ga.groupId = grouped_areas.groupId WHERE CONCAT(d.areapath, '\\') LIKE CONCAT(grouped_areas.areaPaths, '\\%') AND ga.groupId = ?; The inner subquery (grouped_areas) fetches all the area paths associated with each group and concatenates them into a single string using GROUP_CONCAT. Each group's area paths are grouped by the groupId. The main query then joins the data table with groupareas, areas, and grouped_areas subquery. It uses CONCAT to compare each areapath from the data table with the concatenated area paths of the group. The LIKE condition checks if the areapath of each data record starts with any of the concatenated area paths for the group. This effectively matches all records whose areapath is a child of any of the defined area paths for the group. Finally, the DISTINCT keyword ensures that each record is only returned once, preventing duplicates. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  23. To address layout consistency issues in HTML and CSS, ensure proper clearing of floats and utilize techniques like clearfix to prevent unexpected shifts. Additionally, employ responsive design principles and semantic HTML elements to maintain stable layouts across different screen sizes and devices. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  24. Using filter_input_array with FILTER_SANITIZE_FULL_SPECIAL_CHARS for both $_GET and $_POST can provide an additional layer of security by sanitizing input data. However, keep in mind that it may cause unintended behavior if applied indiscriminately to all input. It's generally considered safe, especially when combined with htmlspecialchars, but ensure it doesn't interfere with any specific requirements or data types in your application. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  25. You can achieve this by splitting the user input into separate keywords and then searching for each keyword individually in your database query. public function get_materials_pick($id) { // Split the user input into separate keywords $keywords = explode(" ", $id); // Construct the WHERE clause dynamically to search for each keyword $whereClause = ""; foreach ($keywords as $keyword) { $whereClause .= "(".PREFIX."tprices.ProductDesc LIKE '%$keyword%') OR "; } // Remove the last 'OR' from the WHERE clause $whereClause = rtrim($whereClause, "OR "); // Construct and execute the SQL query $sql = "SELECT ".PREFIX."tprices.IdPrice, ".PREFIX."tprices.Supplier, ".PREFIX."tprices.ProductCode, ".PREFIX."tprices.ProductDesc, ".PREFIX."tprices.Price FROM ".PREFIX."tprices WHERE $whereClause ORDER BY ".PREFIX."tprices.Price, ".PREFIX."tprices.Supplier ASC"; return $this->db->select($sql); } i hope With this modification, you can input keywords in any order, and the function will search for each of them individually in the ProductDesc column of your materials table. This should provide the flexibility you need for searching. Best regard Danish Hafeez | QA Assistant ICTInnovations
×
×
  • 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.