Questions tagged [php]
PHP is a widely used, open source, general-purpose, multi-paradigm, dynamically typed and interpreted scripting language originally designed for server-side web development. Use this tag for questions about programming in the PHP language.
1,437,187
questions
0
votes
0
answers
2
views
Consuming moodle web service with php client
I need to export grades from my moodle to another website, i sought online that you need to create a web service on moodle(i already did it) and now i need an web page with php code to consume my web ...
0
votes
0
answers
7
views
Laravel whereIn get duplicates also
I'm a front-end developer that has been asked to do some Laravel adjustments so please bear with me.
This is the code I'm trying to modify -
```laravel
$location = Location::where('id', $id)->with('...
0
votes
0
answers
5
views
How to count total number of residents registered in one household?
How to count total number of residents registered in one household?
CODE:
$sqlresident = "SELECT h1.householdnum, COUNT(*) FROM tblresidents as h1 INNER JOIN tblhousehold as h2 ON h1.householdnum ...
0
votes
0
answers
8
views
Why does the woocommerce product Attribute remains visible even after I delete it from the Database?
To begin with I have created a simple plugin that contains this piece of code:
function woo_create_credit_attribute_taxonomy() {
$attributes = wc_get_attribute_taxonomies();
$slugs = ...
0
votes
0
answers
6
views
Display woocommerce notice through Ajax callback on product page
I'm trying to display a woocommerce notice in a product page. The notice should by displayed by an ajax callback function, triggered by a button.
The callback is working correctly, but no notice is ...
-1
votes
0
answers
7
views
How to Customise pagination next and prev button actions with custom parameters in the URL?
Let's suppose we are on page 2 on HTTP://localhost/questions?ques_id=2&page=2
and we need the extra parameters like
pre button has
HTTP://localhost/questions?ques_id=1&page=1
next button has
...
-1
votes
0
answers
11
views
Sharing live data from a webapp [closed]
I have created a website with html, css, javascript and php.
This website is connecting via bluetooth using webpack, with a telemedicine device and get some data..
I would like 2 people, by 2 ...
0
votes
0
answers
15
views
Nav bar content moves and sticks on scroll
My issue is that when I scroll on my website my navbar text and logos stick to the top of the screen then proceed to scroll with the page while leaving the nav bar behind. Its spouse to stay inside ...
0
votes
0
answers
10
views
API Curl authorisation not working with php
Am trying to make authorisation with monday.com Api. If run the url link directly on brower it will work fine. but if make a Curl request in php nothing is working
working
https://auth.monday.com/...
0
votes
1
answer
15
views
Foreach Loop - only output first item
I'm working in a smarty template with a foreach loop to output book titles with its corresponding URL as a link from a list. However, I only need to get the first item in the list, but the foreach is ...
0
votes
0
answers
7
views
I want to display the products that are on my companies website in a custom order and I am not quite sure if this is correct
just to add sorry if my wording/grammar is terrible I do suffer from dyslexia.
So I have never actually done any web design, so all I have really learned is through the internet and from what I have ...
0
votes
0
answers
5
views
render Kend UI php chart as svg or png
Is it possible to render chart as a svg, png or binary image by using kendo UI Chart PHP Class
I'm trying to find solution to generate charts from background php script, so any frontend charts with js ...
0
votes
0
answers
8
views
PHP mysqli query execution returns false
<?php
header('Access-Control-Allow-Origin: *');
header('Content-type: application/json');
include'../admin/includes/connection.php';
if (isset($_GET['public_user_id'])) {
$...
-4
votes
0
answers
16
views
PHP syntax error, unexpected token "{", expecting variable [duplicate]
//class constructor
public function __construct(
$dbname = "Newdb",
$tablename = "Productdb",
$servername = "localhost",
$username = &...
-4
votes
1
answer
16
views
How to format a UK registration plate in PHP
I want an inputted string (for example; ae14ekr) for be formatted as: AE14 EKR which is the correct UK format for VRMs (registration plates).
I don't need to validate if the VRM is correct, but I need ...
1
vote
1
answer
13
views
How do I use imagejpeg() with $_FILES["file"]["tmp_name"]
My TensorFlow project only accepts JPEG because that is what I trained it on. I use a PHP image upload form to post the image. Here is how the image is received by the PHP file and is then used in my ...
1
vote
0
answers
14
views
I added function to sort pics according to price they appeared in abnormal size
[enter image description here][1]
[1]: below is the code of sort by button i don't know why this happens while this is not the actually dimensions of the photos
https://i.stack.imgur.com/qxTt1.jpg
&...
-2
votes
0
answers
14
views
how to create Custom Rule for update email admin
I try to create Custorm rule for update email admin.
I want to check in the custom Rule that it will not edit if it is a duplicate email
how to do it???
This is my UniqueEmail.php
<?php
namespace ...
-1
votes
0
answers
15
views
Appending an array with http_build_query to a URL as GET params
I have 4 arrays that I need to send to a script as GET params.
$fp = [ ... ];
$fs = [ ... ];
$ca = [ ... ];
$oa = [ ... ];
$url = "https://something.com/api/1/script?".http_build_query(['fp'...
0
votes
1
answer
23
views
How do I change a value in multiple arrays if I know the key?
I have an array with data.
var_damp like this
array(2) {
["first_attribute"]=> string(10) "attribute_1"
["second_attribute"]=> string(10) "value"
}
...
0
votes
0
answers
16
views
Route middleware not working on live server
Ive run into a strange problem.
I have the following code in my laravel route:
Route::prefix("/user")->middleware("auth:api")->group(function(){
Route::get("/",...
-1
votes
0
answers
9
views
Use parser to add/change HTML style style using PHP?
I need to add letter-spacing to the body a template that would be created by the user(I cannot change it directly via CSS or HTML because It need to be IF(condition) to change the letter-spacing.
$...
1
vote
0
answers
5
views
How to get variation descriptions with Woocommerce Rest API?
In a project I'm working on Woocommerce, I need to get all products and do some operations using PHP and Rest API.
I have successfully listed all of the products. Product descriptions are required in ...
-1
votes
0
answers
12
views
Create a function that will get the value and position for an array,and insert the value at the specified position without losing the old value
function num($new_num,$position){
$result_array = array();
$arr = [1, 2, 3];
for ($i = 0; $i < count($arr); $i++) {
if ($i == $position) {
$result_array[] = $new_num;
}
$...
-2
votes
0
answers
17
views
Photo not getting saved in the Database server
Can anyone tell me what is wrong in my code?
Everything except photo is getting saved in the hosted server. Can anyone please look into it and let me know what is wrong in my code for saving the photo?...
0
votes
0
answers
7
views
PHP automation of options in vue.js by using data from MySQL
I create an vue.js script for collecting data on case values from MySQL database using PHP. You see my codes below, I use 2 connection objects, 2 foreach loops. Is it possible to make this in one SQL ...
0
votes
0
answers
6
views
Fix the problem with set_id function in jsTree
So i'm trying to make jsTree from sql database via php. I have seen a lot of examples, and what i have got at this moment.
This is my php code:
case 'create_node':
$node = isset($_GET['id']) &&...
0
votes
0
answers
14
views
str_replace skip first match
I want to remove all the duplicate script tags after the first script tag. is it possible with PHP str_replace?
<script src="//embed.typeform.com/next/embed.js"></script>
<...
0
votes
0
answers
8
views
Dynamically create chart
I'm using highcharts to create the chart. I'm building the graph as follows:
$.getJSON('denunciasmes.php', function (data) {
$.getJSON('denunciasmes1.php', function (data1) {
var arr = [];
...
0
votes
0
answers
23
views
This page isn’t working127.0.0.1 redirected you too many times. Laravel and Loclhost
I am getting the below error;
This page isn’t working127.0.0.1 redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS
I am trying to pull exchange rates via json API and ...
0
votes
0
answers
13
views
PHP - sending very long string via POST
I have a textarea and very long string (binary data eg: 01 11 21 ...). When I send this data via POST method I don't get a full data. After submit form I check this variable via strlen and I always ...
2
votes
1
answer
14
views
How to embed pdf with iframe with height exactly one page?
I am trying to embed a pdf with an iframe but when I set height to 100% it is really small.
Is there a way to make the height exactly one page?
my code
<iframe src="/wp-content/uploads/test....
0
votes
0
answers
19
views
How Do I retrieve a string value JSON in PHP?
I have a returned string result from an API and it looks like this.. for the life of me, I cannot retried the WorkID value!
The returned string is a json string:
{"notes":"","...
0
votes
0
answers
7
views
Adding values in eloquent deep search
I recently came across the following relationship situation Regional -> coordination -> company -> team -> cell -> paymentbook -> payment , all are 1:n, I'm trying to make the ...
1
vote
0
answers
14
views
Remove query string from iframe in html embed code
I have some 3rd party embed code, which contains an iframe with an autoplay attribute. I would need to remove the ?autoplay=true query string on some conditions.
What's the best way to do this while ...
0
votes
0
answers
12
views
Stripe undefined
I've got a problem with Stripe, I added to 'package.json' this line: "cartalyst/stripe-laravel": "7.0.*" and then used composer update. I hope I did it right. But I get undefined ...
0
votes
0
answers
10
views
"getaddrinfo() thread failed to start" on curl_exec
I got this error randomly when i try to contact the API of UberEats from a Server Windows.
But with exactly the same project, that works always on my OVH Server.
I have configured the Apache and Php....
-1
votes
0
answers
10
views
Laravel Custom Notification (email verification)
i make custom notification for email verification, how can i connect this new custom notification with new event Registered user? By default this command event registered use verify email from vendor, ...
-1
votes
0
answers
14
views
is regexp in mysql with much word, will take time? [closed]
hi i have been make permutation and more user type, the possibility result is more much
and i put the result into regexp
my question is it will make my query slow ?
here the code
if(!empty($...
-3
votes
0
answers
17
views
print("Hello World") randomly appears [closed]
print("Hello World") displays below the footer of my web page - triggered after clicking anywhere on the web page.
I've tried looking for the source code or script prompting this to occur.
...
0
votes
0
answers
8
views
Which approach is best when modeling an entity with polymorphic abstraction, or additional value object?
I'm refactoring a specific model from a meal planner software. You schedule out 3 meals for each day of the week, with recipes that fit within the daily nutritional requirements. Some recipes are also ...
0
votes
0
answers
9
views
Getting error while connecting with redis server in aws
Severity: Warning
Message: Redis::connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
Filename: drivers/Session_redis_driver.php
Line Number: 138
-1
votes
2
answers
22
views
How to fetch data using JOIN clause in php? [duplicate]
I want to match contact from both tables and fetch details of mother in mysql using JOIN clause in php.
Table students
name
mother
mcontact
Larry
Wanda
12345678
Table parents
name
parent_of
...
-1
votes
0
answers
17
views
Rewrite everything but specific part of URL
I have this user-generated URL: https://example.com/watch.php?name=I9an9O.mp4
What i'm trying to achieve is to grab the part that is in between of "name=" and ".mp4" (I9an9O)
And ...
0
votes
0
answers
14
views
PHP create certificate CA not self signed
I m trying to create a Certificate CA = not self signed. I 'm using the function PHP openssl_x509_export
For create Self Signed certificate no problem. But when I must create a certificate with Owner ...
2
votes
1
answer
32
views
PHP Calculator Using Buttons Giving Wrong Result
I am new to php and trying to make a calculator using using buttons. I want to display the result only when the user press = button.
Here is the code:
<td><input type="text" name=&...
0
votes
0
answers
11
views
Building a deep Nested array of objects in PHP using Recursion
Basically, this is what I want to achieve
Jason
->Ronda
->Cat
->Abraham
->Jacob
->Joseph
->Brock
->Dustin
...
0
votes
0
answers
13
views
custom function doesn't work in child theme functions.php
I am having this code in functions.php to display the message on order complete, but nothing happened when changing the order status.
Here is the full code
/* -----------------------------------------...
0
votes
1
answer
22
views
Decomposing a string into words separared by spaces, ignoring spaces within quoted strings, and considering ( and ) as words
How can I explode the following string:
+test +word any -sample (+toto +titi "generic test") -column:"test this" (+data id:1234)
into
Array('+test', '+word', 'any', '-sample', '(',...
0
votes
0
answers
19
views
#Laravel How do I store value with switch-button
I want to store value from switch button but I can't save value when switch off
in my blade.
<input name="serial_status[]" type="checkbox"
data-toggle="switchbutton" ...