Questions tagged [php]

PHP is a widely used, high-level, dynamic, object-oriented and interpreted scripting language primarily designed for server-side web development.

0
votes
0answers
7 views

Mysql Select With nested If and count

need help with my code please SELECT tbl.field_1, IF(tbl.field_1='Something',COUNT(IF(tbl.visit_type='Emergency',4, NULL)),COUNT(IF(tbl.visit_type='Emergency',1, NULL))) 'Emergency', COUNT(*) AS ...
0
votes
0answers
5 views

Symfony php Custom exception controller not working

I'm trying to create a custom exception controller in php Symfony 4. Essentially what I want to do is to have a default route that gets called when no other routes match. I'm trying to follow the ...
0
votes
0answers
4 views

how can i get the value of an an auto incremented id as a foreign key in a different table in Laravel inside a controller

// In the table called template I get the id of staffmembers by using session . however I really don't know how I can to it for the table module . I am coding using Laravel framework. I also get this ...
0
votes
0answers
14 views

How to update value of input after change of dropdown which is populated by mysql?

I have run into a problem and Im not sure where to start... So my problem is- I need to use a dropdown which is automatically populated by a query concatenating two fields to make a single full-name. ...
0
votes
0answers
4 views

Attempting to pass a returned value to WP's rest_ensure_response()

This is probably a PHP fundamental, so apologise if I'm stupid in advance. I'm building a simple plugin for Wordpress which accesses wp_head, grabs the code block (scripts and styles) and then ...
0
votes
0answers
19 views

Passing PHP variable to a hidden subclass

Just a quick question. Is there some security flaws with passing PHP variables taken from MySQL table to a hidden subclass of some class so that when a parent class when clicked can be passed onto and ...
0
votes
0answers
6 views

Why would a page not return any xpath?

I have run across a few internet pages where when I run xpath queries (that WORK in 2 different xpath checker chrome extensions), they don't return on my PHP page that I'm running them from. I'm ...
0
votes
1answer
15 views

run laravel project without artisan serve

i have an issue that i want to run my laravel project without cmd command php artisan serve , i want something like usually in php project localhost/projectName , when i do all the steps like changing ...
0
votes
0answers
13 views

Make tab active which contains the search result in wordpress

In my wordpress site, I have few pages which have tabs. The tabs are generated dynamically from ACF repeater fields.Now, when I use the default wordpress search and the result text is inside a tab, ...
0
votes
0answers
5 views

TYPO3: How to persists references?

I'm using TYPO3 9.4 and have a extbase Extension. The extensions provides two domain models. I will call these Model-A and Model-B. Within a frontend action, someone can create a new object of Model-B....
0
votes
0answers
9 views

Firebase (FCM) Response messes up my Response

I'm sending Web Push Notification via PHP cURL after my order successfully inserted into the database. After insertion, my return response is this: { "statusCode": 200, "status": true, "...
0
votes
0answers
9 views

Attribute in SOAP PHP

I'm trying to reproduce a XML in PHP SOAP, and I'm stuck when I try to set an attribute. Example : what I want to reproduce How my code looks like: $headerToken = new \SoapHeader($asxm,'fueloauth',$...
0
votes
0answers
20 views

Getting invalid parameter marker on db2 query with additional bound value

I have a php script where I'm executing some PDO statements and everything's been working until now. I recently added the sg.group_code as group_code into my first select, binding it as one of my ...
1
vote
2answers
22 views

How to append data in php file

Previously I'm using php to append form data into json file. Currently I am working on php file instead of json file and it has two parameteres and it is shown to users as given in figure Image url ...
-4
votes
0answers
11 views

Yii2 ipv4 and ipv6 ad hoc validation with & without subnet

Yii2 ipv4 and ipv6 ad hoc validation with and without subnet Refer link enter link description here How to do same for Class yii\validators\IpValidator
0
votes
0answers
9 views

PHP/AJAX + read serial port on Raspberry Pi

I can -NOT- READ data coming from the serial port (sent by connected Arduino via USB cable on COM1) Although I can -send- without any issue repeatedly... I can NOT receive/read. Project summary: ...
0
votes
1answer
17 views

Get selected values in multiselect form field

I'm updating a PHP form field from a dropdown (single value selected) to a multiselect (multiple values selected). I have 2 DB tables, one where the complete list of team members reside, and the ...
-1
votes
0answers
15 views

Sending mail with Symfony 4 : no error but no mail received [duplicate]

I'm trying to send a simple mail with Swiftmailer using the console. The console, at the end, echoes [OK] 1 emails were successfully sent., but no mail was received in my mailbox (note : my mail php ...
0
votes
0answers
14 views

php return extra space after form upload with AJAX

I have a form uploaded into the db with AJAX. The page php where I have the code to upload the form return "Success" in case the uplaod was successful, "Failed" in the other case. In my main page (...
-3
votes
2answers
35 views

Capitalize the encoded part of encoded url in PHP

I have string urls like this: $url = 'htttp://mysite.com/sub1/sub2/%d8%f01' I'd like to capitalize the encoded part of an url(only %** substrings) as per example it is '%d8%f01' so final url will ...
0
votes
0answers
5 views

Dash Integration for interactive graphs visualization in PHP based Website

I am working on a project in which I need to integrate dash into a website based on PHP for visualization of interactive graphs. Is it possible to integrate dash in PHP or I need to write the whole ...
0
votes
0answers
42 views

SQL - Check each column of database to find value?

How do I go through each column of my MySQL database to return the value of a column if it is like a given variable? e.g. database: username | password | column1 | column2 | column3 | column 4 |...
0
votes
0answers
12 views

Laravel 5.7 verify email localization

Laravel provides an ability to use different language by using app.config + lang folder. However, I don't see any reference in the docs on how to translate base email. I've enabled email verification,...
0
votes
0answers
13 views

Product Filter in php using Ajax + pagination

I'm trying to add pagination to this tutorial How to Make Product Filter in php using Ajax Pagination without page refresh works (so far without links). It means displays only 5 records per page, but ...
1
vote
0answers
17 views

PHPUnit is showing test as passed when there are Fatal Exception Errors

I am using Netbeans 8.2 and PHPUnit 4.8.36 along with PHP 5.6.36 and I have some issue when there is some Fatal Error Exception within the tests functions. /** * @runInSeparateProcess */ ...
0
votes
0answers
14 views

Console php version diferent to MAMP on OS X

I have created a .bash_profile in my home and now it contains the following two lines: export MAMP_PHP=/Application/MAMP/bin/php/php7.2.7/bin export PATH="$MAMP_PHP:$PATH" But the php -v command in ...
-1
votes
1answer
26 views

PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in php [on hold]

I'm trying to do an update with PDO and I'm getting an error that I'm not detecting where the problem is. The error is this: Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter ...
0
votes
1answer
25 views

How can I authenticate users in phpunit Testing using Passport

I am trying to write a PHPUnit test that authenticates a user first before allowing the user to make a post request but got the error 1) Tests\Feature\BooksTest::...
0
votes
0answers
36 views

How to sum the selected values from the radio button and pass to submit

I need the sum the values from the selected radio button and add to the submit button. Find the code below : <?php foreach($configure['options']['option'] as $options) { ?> <label ...
0
votes
0answers
10 views

Excel File Download Blocked by Ext JS

Actually, I would like to Trigger the automatic download of a generated excel file in an Ext JS Page. Is there any example source code which could help? Find Below my personnal source code which is ...
0
votes
1answer
37 views

Php top list from arrays [duplicate]

How do you make someone who has a higher subscriberCount be sorted to the top? For example, I want to list the top 50 by subscriberCount. Currently it just sorts by the order added to $topchan1["items"...
0
votes
0answers
13 views

WooCommerce - Remove variation from product title in order details and email

I have a variation called "China" on some of my products. The way WooCommerce works, is that inside the cart, order details and emails, the variations are being appended to the product title. I would ...
2
votes
1answer
30 views

split a value into two and then reverse the value in php

I have a value like this 73b6424b. I want to split value into two parts. Like 73b6 and 424b. Then the two split value want to reverse. Like 424b and 73b6. And concatenate this two value like this ...
0
votes
1answer
13 views

SF4/WWebpack - Javascript Function Is Not Defined

I'm using Symfony's WebPack.Encore bundle and I realize one thing is that for a single button onclick = function (), my function is not defined, whereas if I put it in a document.ready, it works. Can ...
-2
votes
0answers
32 views

How to prevent SQL injection in mysqli_real_escape_string? [duplicate]

What are the differences between mysqli_real_escape_string and mysql_real_escape_string ? How can we prevent SQL injections? Does pattern="[a-z0-9]+" has any effect in security since it ...
0
votes
2answers
23 views

Removing single quotes when retrieving data with php mysqli SELECT

I retrieve some database entries with php mysqli SELECT. Some of the entries contain a single quote (ie : L'avant du bâtiment). This generates a parse error and breaks my webpage down. Here is the ...
-2
votes
0answers
21 views

How can i set condition if one column has NULL value then don't show results

Thas my controller file public function myFriends() { Logged user $uid = Auth::user()->id; Getting result from friendships table $friends1 = DB::table('friendships') ...
-5
votes
0answers
21 views

Textarea content not displaying in lines when submit using php

I have a very small form and when I submit its all the data of textarea. It shows in one line with \n\r between all the words. So, I used nl2br() and str_replace() etc. but no luck because then I ...
0
votes
0answers
41 views

MySQL Cannot connect via remote php script access

I'm having an issue with MySQL, using PHP PDO on CentOS 7. I'm able to connect to the mysql database via my script on localhost, on the dedicated serverside, An when tested through a separate ...
0
votes
0answers
5 views

How to implement an slider in Google AMP with URL change?

Each article can slide with the navigation icons appearing at the top of the page, at the same time on each slide, the article changes with the URL. In AMP we have, amp-next-page. But, this will ...
-1
votes
1answer
25 views

how to compare two json file in php

i am working on json file to compare their data only want to show the same data but i want to compare both whole file code i am using <?php $data = file_get_contents("json/categories.json"); $...
0
votes
1answer
19 views

Preview or Download PDF does not work in PHP Code

I know this question is old and there is a lot of code here, but I tested it several and none worked for me. I'm trying to make it available to view or download a PDF file (whichever works) in a php ...
0
votes
1answer
29 views

Is the null-coalescing operator a good thing?

I personally find myself using it a lot of times just to prevent, for example, "Undefined index" exceptions when trying to access arrays. In addition, I find myself then using this to check if an ...
-1
votes
5answers
24 views

How to keep selected value of a select input with multiple options after submit with php

I have a select input with 2 options. I will like to keep the selected value after submit button is been clicked with php. Below is the code which am using which only works for the first option and ...
1
vote
0answers
7 views

Magento 2 Configurable product images showing with child products

I added images in magento 2 configurable product and then I added 3 child products with images but on product detail page after selected child product it is showing both images (parent and child ...
0
votes
1answer
7 views

How to redirect url like “http://www.example.com/pathquery-string=something” to error page using htaccess file

How to redirect url like "http://www.example.com/pathstring=something" to error page using htaccess file. "http://www.example.com/path" this is part of url and "string=something" is part of query ...
-3
votes
0answers
21 views

Scripts are not loaded properly on server

Below code is working fine in local host but its not working on server. on clicking on status-update model was displayed,status drop-down is displayed on the model but after selecting/without ...
0
votes
1answer
17 views

How to append the Data from Top using PHP in Json file

I"m using php to append the data in Json file. It works correctly but it appends the data at the bottom. I want to add the data on the top ...such that user could see new data first. Here is my php ...
0
votes
1answer
22 views

inside array of arrays if there is missing index then add empty index for missing index

//this is the array is have and the below is what i want $data = array( array( 'title' => 'My title', 'date' => 'My date' ), array( 'title' =>...
0
votes
0answers
10 views

BitExchange, admin panel DON'T save settings (crypto exchnage script) [on hold]

I have installed on my VPS the script BitExchange (an crypto exchange script) I've joined to the admin panel and changed some settings, but when I click on Save settings the page reloads but the ...