Questions tagged [php]

PHP is a versatile scripting language that was initially developed for server-side web development. It is open-source, supporting multiple paradigms and possessing dynamic typing capabilities. If you have any queries regarding PHP programming, feel free to use this tag.

"Encountering an issue with CodeIgniter where the cart feature

Having just started with CI, I am currently working on developing an e-commerce website. However, I am facing challenges when it comes to adding products to the cart. Below, you can find the code for both the Jscript and controller that I have been using. ...

Struggling to construct a binary tree as my descendants are not arranged in the right sequence

I am currently working on building a binary tree using PHP, MySQL, and a jQuery plugin developed by Frank-Mich. Here is the progress I have made so far... DATABASE STRUCTURE CREATE TABLE IF NOT EXISTS `members` ( `id` int(11) NOT NULL AUTO_INCREMENT, ...

Tips for resolving an error in PHP and MYSQL code where data is being selected from the incorrect table in the database

I am working on a PHP code with MYSQL. It involves selecting data from the database using a dropdown list with AJAX and displaying the results on the screen. I have three dropdown lists that are dependent on each other and each dropdown has its own table t ...

Establishing a Protected Link to a Server through PHP

I'm working on accessing a database located on a server that I only have Remote Desktop access to. What steps do I need to take in order to query this database using my php web application? ...

My documentation remains outdated as phpdoc fails to update it

Running phpDocumentor version 1.4.4 on Fedora 24. Executing command line: phpdoc -d ./docsrc -t ./output Initially, I successfully generated documentation for my project, but subsequent updates do not reflect in the output. Even after adding docblocks to ...

My GraphQL Query is throwing a JSON error when using the curlopt_postfields option. What could be causing this

I'm having some trouble with my code and I keep encountering this error message. Any ideas on what might be causing this issue? I believe I've properly escaped all the quotations. {"errors":[{"message":"json body could ...

Unable to access Nginx when attempting to send a post request with a JSON payload that includes a base64 string

Whenever I attempt to send a post request with json data: { "img":"base64code..." } I encounter two different errors: 2018/04/14 00:43:21 [crit] 2737#0: *1770 open() "/opt/bitnami/nginx/tmp/client_body/8/01/0000000018" failed (13: Permission ...

Since switching to PHP 5.5 from version 3.x, I have noticed that it is attempting to interpret my JavaScript comment within a script tag in a PHP include file

After a long break from working with PHP, I recently encountered an issue with an older website I built using PHP and the include function. The site was functioning perfectly until the web host updated PHP to version 5.5, causing a strange bug where it see ...

Unable to obtain the Twilio "call recording" URL

Currently, I am working on an online campaign management system that utilizes Twilio. Each campaign in the system will have a unique Twilio number and target number. When a call is made to a specific Twilio number assigned to a campaign, it will be forward ...

Using PHP to output HTML tags as text

How can I display an HTML tag as text on screen, rather than in code format? I want readers to be able to easily read the tag itself. What is considered the best practice for achieving this? print htmlspecialchars('<meta name="copyright" content="© ...

Navigate through the items in my subnavbar by scrolling the content

HTML Code <div id="subnavigation"> <?php $verbindung = mysql_connect("host", "user" , "pw") or die("Verbindung zur Datenbank konnte nicht hergestellt werden"); mysql_select_db("db") or die ("Datenbank konnte nicht ausgewählt w ...

The WordPress administrator encounters the error message "Database selection is not available"

UPDATE: I just wanted to express my gratitude for all of your support, everyone. The issue was on the server side, but it has been successfully resolved and my website is now back up and running smoothly. Please take a moment to visit www.bestlappyforme.t ...

Leveraging the X-Send module for efficiently delivering css, javascript, and image files

I am in the process of setting up a file server that currently serves downloadable files such as .doc and .zip perfectly using X-Send. Is it also possible to use X-Send for serving text-based (css/javascript) or image files? I believe this method is quite ...

Guide on presenting an image retrieved from a database with ajax

I am currently developing a straightforward mobile application that utilizes a database to store various types of content, including images. I have implemented ajax requests to retrieve this information and display it within the app. However, I am encounte ...

How can I search for a product's SKU using a metadata field?

Is there a way to retrieve all the SKUs for a Product in Stripe through a query? Additionally, I would like to filter that set based on a specific value of a metadata field. Is it feasible to achieve this? Scenario I am managing voucher codes (differen ...

Ensuring Unique CSS for Diverse Devices: A User-Agent Driven Approach

I am facing multiple challenges and working towards finding solutions. I have developed a webpage and now I want to redirect the link to the CSS file based on the user agent. `<script type="text/css" src="style.css"> </script>` However, inst ...

Retrieve the Javascript variable and assign it to a PHP variable

When attempting to assign a JavaScript variable to a PHP variable and output the value in an alert, I am encountering an error. The output is shown as "; alert(simple); var p1sds = "My Custom String"; <?php $dsfd = "<script>document.writeln(p ...

Error is being returned by the JSONP callback

Looking to grasp JSONP. Based on my online research, I've gathered that it involves invoking a function with a callback. Other than that, is the way data is handled and the data format similar to JSON? I'm experimenting with JSONP as shown below, but I'm ...

Is it true that echo and print are disabled in the 'real-time' version of php?

As a newcomer to programming, I can only describe my script as live, although I know that might not be the correct term. Initially, I developed a bot in php and ran it on xampp locally on my mac, where I could easily print arrays and other content using ec ...

Manipulating Tables with Jquery

I've used PHP to dynamically create a table with varying numbers of rows based on user input. Each row is supposed to have its values calculated and displayed in the last column when focused. <select name="number" id="number" onchange="document.form2. ...

How can I use a foreach loop to filter data from simplexml_load_file?

Looking for PHP help: <?php $website_url = 'domain.com/sitemap.xml'; $xml=simplexml_load_file(''. $website_url.'') or die("Error: Cannot create object"); foreach($xml->url as $val) { echo $val->loc. '<br>'; } My code successfully ext ...

Show unique field data characteristics encoded in multidimensional arrays in WordPress

Looking to showcase a custom field meta_key value from WordPress. The information is stored as a custom field meta_key value in WordPress $data = get_post_meta( get_the_ID(), 'data', false); print_r($data); Array ( [0] => [ { "title":&quo ...

Failure to Display Variable Dump

Having trouble with getting the Var Dump to display properly and all I see is a white screen. Any advice or suggestions on how to fix this? <?php require('includes/config.inc.php'); require(MYSQL); $aid = FALSE; if (isset($_GET['aid&apos ...

PHP handling AJAX request during execution of lengthy script

I recently posted a question on Stack Overflow where I received a satisfactory response that is working perfectly. However, I seem to be facing an issue where all AJAX requests stop functioning when the script runs for more than 4 to 5 seconds until the en ...

The update query inadvertently modifies all entries in the database rather than targeting a specific one

Having recently started using the Zend framework, I am encountering an issue when trying to update data in the database and grid. Instead of updating a specific row, all rows are being updated. Can someone please assist me with this? Below is my controlle ...

Incorrect data retrieved for numeric (integer) fields via ODBC access

Currently, I am in the process of developing an application that requires the importation of Microsoft Access files. This application is built using PHP, and I followed a specific tutorial to configure the environment (https://gist.github.com/amirkdv/96728 ...

Incorporate External Data Source into Magento Admin Products Grid

I'm working on creating a split screen view with one grid displaying products from a remote repository, and another grid showing products from a local repository. To simplify things, all I really need help with is incorporating the remote source into ...

XML data is not returned by the __getLastResponse function

Encountering an issue where I am unable to retrieve the XML response. The response seems correct when stored in the PHP variable $lists, but attempting to extract the XML version of the response using _getLastResponse does not display any XML. Below is th ...

I am looking to save the session value into the search box of the appTables application by utilizing jQuery

Is there a way to save the session value in the search box of appTables by using jQuery? <?php $session = \Config\Services::session(); ?> <script type="text/javascript"> $(document).ready(function () { var searc ...

Transferring the link value to an AJAX function when the onclick event is triggered

I have a link containing some data. For example: <li><a href="" onclick="getcategory(this);"><?php echo $result22['category']; ?></a></li> I need this link to pass the value of $result22['category']; to ...

Confirm deletion in PHP by displaying the entry to be removed before proceeding

I created a delete form where the user can input the pnum to be deleted and then the corresponding record will be deleted. However, I want the user to be able to preview what will be deleted before confirming. I attempted the following code, but it did not ...

What is causing my thumb generator to produce only 36 images before abruptly halting?

I manage a photo-sharing website and am looking to optimize loading speed by creating image thumbnails. <?php function generate_thumbnail($image, $thumbPath){ $img = imagecreatefromjpeg($image); $width = imagesx($img); $ ...

Encoding the output as JSON and displaying the result

This is the PHP code I am using: $query=mysql_query("SELECT * FROM product"); $bla = array(); $numOfRows= mysql_num_rows($query); if ($numOfRows >0) { while ($rows=mysql_fetch_array($query,MYSQL_ASSOC)) { //$pro ...

How to Create an Alert Message with Title and Dismiss Button in Joomla

After receiving a response from an ajax call, I am trying to display a Joomla notice. Here is the code: $app = JFactory::getApplication(); $app->enqueueMessage('Joomla notice', 'info'); When rendered on the front end, it appears as follows (please not ...

Guide to securely encrypting passwords when transferring from an Android device to a PHP server

As a beginner in programming, I am currently working on a small application running on an Android device that requires user-based information from my PHP web server. My strategy involves using JSON for communication between the phone and the server. The p ...

Ensure to check for any expired dates and remove them from the system after one day

My main goal is... If the expiration date has passed, the script will grant the user an extra day. If the user is not subscribed, their data will be removed. Is there a better way to achieve this? I attempted using INTERVAL 1 DAY, but I am uncertain if i ...

Inquiry regarding the management of data storage and retrieval for a sophisticated webpage

Currently, I am working with php and mysql within my stack. My current project involves designing a page that will showcase details of a mutual fund. The challenge lies in the fact that data for a single fund is spread across 15-20 different tables. To add ...

While PHP confirmed it to be true, Jquery AJAX contradicted and said it

Currently, I am in the process of developing an application that requires checking for the existence of a product. To achieve this functionality, I opted to utilize jQuery due to its user-friendly nature. However, I have encountered some challenges in veri ...

Using Unicode JSON in Laravel blade to pass data to React components, encountering an issue with JSON parsing

I currently have a JSON object stored in the database: { "ui": {}, "title": "Hola mundo 2", "values": {}, "properties": {}, "description": "descripcion" } Within the Laravel controller, ...

What is the best way to achieve line breaks in text that auto-wraps in JavaScript/PHP?

My resizable div contains text/sentences. As I adjust the size of the div, the text wraps itself to perfectly fit within the available space in the container div. Now, I am faced with the task of converting this dynamic text into an image using php and th ...

I wonder if the server configuration has any impact on the failure of serialization and unserialization processes

Could a specific server configuration be causing the need to force serialize and unserialize blocks? Or is it simply due to a poorly installed PHP on the server? Has anyone encountered a similar situation before? ...

dispatch email display Twitter Bootstrap notification utilizing Ajax

I'm trying to set up an email sending feature via a contact form. I want it to send the email and display a Bootstrap alert confirming that the email has been sent. Below is the HTML code: https://jsfiddle.net/6rfeas35/. Additionally, here is my PHP c ...

What is the best way to show a partial based on the variable in the index function of my controller?

I've been struggling to correctly display my partial based on the variable inside my index function. I've experimented with various approaches such as {{ $test }}, "test", and $test in the if statement without success. How can I resolve this issu ...

In PHP and MySQL, the GROUP BY clause does not function properly with datetime data types

I have a variety of datetimes stored in my MySQL database, listed as follows: 2016-11-15 10:00:00 2016-11-16 10:00:00 2016-11-17 10:00:00 2016-11-17 12:00:00 2016-11-17 19:30:00 2016-11-20 10:00:00 2016-12-15 10:00:00 2017-11-15 10:22:00 I need to displa ...

Looping through a multidimensional array in $_POST variables

I have developed a form that sends me multiple values using the post function. The $_POST[groups] contains values 1, 2, 4, and 8 based on 4 different checkboxes. Similarly, $_POST[retailgroup] includes only the values 1, 2, and 4. I want to combine these v ...

Interconnected Dropdown Menus

I've implemented the cascading dropdown jQuery plugin available at https://github.com/dnasir/jquery-cascading-dropdown. In my setup, I have two dropdowns named 'Client' and 'Site'. The goal is to dynamically reduce the list of sites based on the client s ...

Transform the string into a time format using PHP

When working with PHP, I often come across times in the following format: $time = '2015-06-29T16:00:00Z'; My goal is to convert this time into a more readable format like this: Tuesday, December 16, 2015 3:00 PM I attempted to achieve this using the fol ...

Enhanced Slider Display featuring Multiple Posts for Improved Performance

My Sample Page features a slider that displays over 200 posts, each containing 5 images. However, the slider loads all the images at once, causing my page speed to be very slow. I am looking for an optimized way to display the slider without compromising l ...

Why does PHP external API access fail when requested from a different page on the same domain?

Currently, I am experimenting with cross-site scripting using Jquery and PHP/Symfony (HttpFoundation Component), but I'm facing difficulties in obtaining the necessary data from the server. My objective is to have Jquery fetch JSON from the local dom ...

Unlocking the Power of AJAX: A Step-by-Step Guide to

How can I use AJAX to return two parameters? I have a section in my HTML page with two textareas. <textarea name="input" id="input" onkeyup="handleInput(this.value);}"></textarea> <textarea name="response1" id="response1"></textarea& ...

Avoid multiple clients from re-evaluating Redis values simultaneously

Imagine a scenario where our website has important counters on every page, making it heavily loaded. These counters are stored in Redis keys that automatically expire in an hour. Within our code, we have a check to see if a key containing a counter exists ...

Issues with PHP code not displaying properly in HTML email design

I am struggling to understand why some of my PHP code is not rendering correctly in an HTML email that I am working on. The following is an excerpt from the code (with most of the HTML elements removed): $messaget = " <html> <head> <title&g ...

Reconstruct jstree once ul or li elements are added through ajax

Is there a way to rebuild jstree after adding ul/li elements through ajax? Currently, I am initializing the js tree using the html structure of ul li. For example, let's say I want to add an li element with the text "clickme" to the first node. Initially, ...

What steps should I take to fix the error "Unrecognized function call to AppHttpControllersJSON_EXTRACT() in Laravel 5.3"?

Let's say I have a table A with a column named json. The json column contains data like this: record 1 : {"dept_code": "012", "unit_code": "22"} record 2 : {"dept_code": "013", "unit_code": "23"} and so on I am looking to retrieve the records from the j ...

The Vuejs code functions properly in the overall application, but is not functioning within the specific component

Before, my Vue.js app worked flawlessly until I tried putting it into a Vue component. It started throwing the following error: [Vue warn]: Error compiling template. Here's the code for the component (components.php): <script> Vue.component(&ap ...

403 error when making an Ajax post request in CakePHP despite having granted all permissions

Encountered a 403 error when making an Ajax request in a Cakephp project. Despite having all permissions granted for the project directory in localhost (XAMPP). Error message: "Failed to load resource: the server responded with a status of 403 (Forbidde ...

Using PHP, create a menu tree by filtering an array

$this->loadModel('Menu'); $this->loadModel('SubMenu'); $this->loadModel('SubSubMenu'); $options['joins'] = array( array('table' => 'sub_menus', ...

dynamic jquery checkbox limit

I am working with the following HTML code: <input type="checkbox" id="perlengkapans" data-stok="[1]" onchange="ambil($(this))"> name item 1 <input type="checkbox" id="perlengkapans" data-stok="[4]" onchange="ambil($(this))"> name item 2 &l ...

How can JavaScript allow access to files outside of a web server environment? Could .htaccess provide a

Currently, I'm facing a challenge with my local server on Mac 10.8. I am trying to serve files such as videos and images from an external hard drive. The path for the external hard drive is HD: /Volumes/ while the web server's path is /Library/Server/Web/D ...

Loading images in advance using JavaScript

I have been searching through multiple forums and cannot seem to figure out the issue. The problem I am encountering is related to a website where there are three images with a hover effect. When the page first loads, there is a delay in loading the backgr ...

The variable ajax_object is not defined

Hey there, I'm facing an issue with my script that is supposed to save data into the database when a link is clicked. However, I keep getting the following error message: ReferenceError: ajax_object is not defined Below is the script I have on my single- ...

Save files using file_put_contents and monitor the progress

When writing code to download a file and return the status (downloaded bytes), I utilize the file_put_contents method which works effectively. function downloadLink($link,$destination) { $ctx = stream_context_create(); stream_context_set_params($c ...

Issue with displaying the Bootstrap paginator stylingSomething seems to be

Currently, I am working on a PHP project that involves creating a table with Bootstrap styling. To achieve this, I referred to a tutorial which guided me through the process. After linking the necessary Bootstrap CSS file using the provided code snippet, ...

Issue encountered while attempting to retrieve the array object

Encountering an issue while returning an array object and displaying it to the user in a demo code snippet. The basic snippet resembles the actual long code that cannot be posted here. Class foobar{ public function foo() { return array( 'bar' = ...

Executing SQL Commands

Trying to figure out how to dynamically insert a row into an HTML table and then update the corresponding database entry. There's a SQL prepare and execute statement in a separate PHP file, but I need to find a way to include variables inside the execute s ...

What is the specific hook in WordPress that is utilized for creating a customized login URL?

Looking to create a WordPress plugin that allows for custom URLs (besides wp-admin.php and wp-login.php). Interested in finding out the necessary hook to achieve this. Thanks! ...

What is the best way to format text within the _e() function in WordPress?

As I work on developing a basic plugin, I encountered the following line of code: echo "<p style="color:red;">Please enter a valid email address!</p>"; I aim to make this plugin easy to localize and internationalize, so I ...

What is the proper way to incorporate a hashtag (#) into a PHP parameter within a URL

Currently, I am sending a PHP request to a login handler using the following URL: https://example.com/test.php?username=test123&password=hiuhsda3#24 However, I need to retain the hashtag in either the password or username along with anything that come ...

In PHP, determining whether two arrays hold the same values but in a different order

Is there a way to quickly verify in PHP if two arrays contain the same items, even if their order is different? If you are working with integer arrays, you can refer to this solution: How to check if two indexed arrays have same values even if the order i ...

Replacing a variable in LessPHP with PHP

I have been using LessPHP (v0.3.4-2) and I have read the documentation and searched for answers to this basic question, but I am still unable to find the correct and straightforward solution. Below is my .less file: @bgcolor :#ccc; .color(@color:#222) { ...

Are you experiencing an issue with UTF8 in PHP, Ajax, or jQuery

When I insert text into my SQL INSERT statements and it is stored in the database, the displayed text does not match what was expected. For example: This is the actual text in the database: lažljivo. However, the expected text should be lažljivo (in ...

Issue with Laravel QR Code functionality when trying to send emails

I am currently using Laravel version "5.8" After installing composer require simplesoftwareio/simple-qrcode for generating QR codes To display a QR code in a view, I am utilizing the following code: {!! QrCode::size(80)->generate('test data'); !!} Ho ...

Flexible Options in Drop-Down Menus

Is it possible to create a dynamic dropdown menu that displays the available quantity of products in stock? For example, if there are 45 products in stock, the dropdown should show numbers from 1 to 45. However, if 5 products have already been sold out, th ...

Creating dynamic cubes in Magento with interact.js within a .phtml template

I utilized the interact.js library to create this code snippet, which functions perfectly on Chrome, Firefox, and w3schools "Try it Yourself" platform (unfortunately not compatible with Edge and IE for unknown reasons). However, when I include this code wi ...

What is the best approach to determine the numerical equivalents of options in a dropdown menu using PHP and JS

Hey guys, I'm really stuck on this problem and I can't seem to find a helpful tutorial anywhere. I've got a form with two drop-down menus, each with a "value" attribute. What I want is for users to be able to select an item from both drop-downs, and then s ...