Questions tagged [php]

406857 questions
1

votes
0

answer
44

Views

how to display a pdf file as a download link from mysql without path directing way in php?

I tried to display pdf files from mysql in the webpage without any path directory. is it possible to do that? I tried this:
saisun7
1

votes
0

answer
249

Views

Krajee's file input only upload last selected image

I'm working with this plugin in Codeigniter as I want to upload multiple files (either it can be multiple images, videos or files) and as mentioned there I have done the following code HTML Script $('#attachment').fileinput({ uploadUrl: '#', uploadAsync: false, showCaption: false, fileActionSettings...
Mr. Pyramid
1

votes
1

answer
426

Views

Get error 'MongoResultException' when use aggregate in mongoDB

When i use aggregatein PHP, i get error: MongoResultException: localhost:27017: The 'cursor' option is required, except for aggregate with the explain argument I use mongoDB 3.6 and PHP 5.6 Please see the photo My Code: $dbconn = new MongoClient(); $c = $dbconn->selectDB('test')->selectCollection('...
noovin
1

votes
1

answer
373

Views

Android sending Lat Long to php and storing in mysql

So I am using Android points = new ArrayList(); to track a users GPS location every 3 seconds, which sometimes can be up to 1,000's or more points if they are on a route long enough. What is the best method for sending this route after they finish to my php and storing it into mysql? I am currently...
user2101081
1

votes
1

answer
1.6k

Views

Magento 2 / Custom Config Field Array Mapping

hope your will have the time to help me. On any circumstances my Magento 2 Array Mapping will not write selected='selected' to my field. Getting crazy about this. The Data will be saved and fetched correct. Big thanks to your help. Version: Magento 2.2.2 /app/code/Sumedia/Switcher/Block/Adminhtml/Sy...
Sudo
1

votes
0

answer
31

Views

Google charts script return error on feed Data column(s) for axis #0 cannot be of type string

The following script using Google charts returns a error Data column(s) for axis #0 cannot be of type string Basically booking are made daily and are Active when a booking has been seen it will be given different attribute. It should count the booking1_date and return a number for that date and dis...
user3285278
1

votes
0

answer
211

Views

HasManyThrough Polymorphic model or morphto without intermediary?

Consider the following Eloquent docs polymorphic example as a starting point: (https://laravel.com/docs/5.5/eloquent-relationships#polymorphic-relations) In this variation, it's a bit of a reverse direction. User hasMany Medias. Medias are polymorphic and can be any model. Goal is to be able to que...
eric
1

votes
1

answer
748

Views

Add text for specific product category in Woocommerce [duplicate]

This question already has an answer here: Targeting product terms from a custom taxonomy in WooCommerce 1 answer I'm trying to add some text only on the specific products of determinate category in woocommerce, I tried to add this code in plugins/woocommerce/single-product/meta.php but don't work:...
delfinoweb
1

votes
1

answer
80

Views

Remain constant Woocommerce prices regardless of tax rate - B2C

Note - im new, so please be kind. If anything isnt clear please tell me, so i can improve my questioning! As a person who lives in europe and sells products to end-consumers, the following problem is very ipmortant and in my opinion heavily under-prioritised. There are a lot of conversation regardin...
evavienna
1

votes
1

answer
459

Views

Symfony AbstractController Not Found After Composer Update

I just ran a composer update and now when I try to access my website I get this error: ClassNotFoundException in SecurityController.php line 28: Attempted to load class 'AbstractController' from namespace 'Symfony\Bundle\FrameworkBundle\Controller'. Did you forget a 'use' statement for another name...
LargeTuna
1

votes
0

answer
622

Views

Cannot read property 'DataTable' of undefined in google charts

as the title saying im getting this error when trying to get charts inside function in another file like this functions.php function get_likes($catid){ require dirname (__FILE__).'/dbfunction.php'; ?> google.charts.load('current', {'packages':['corechart']}); a= ; b= ; c= ; i= ; ///// this i is...
Samir Daraf
9

votes
1

answer
20k

Views

Get in WooCommerce cart the product ID of a cart item

$cart_item = $woocommerce->cart->get_cart(); I have the above code. if I run print_r on cart_item I get a multi dimensional array: Array( [a6292668b36ef412fa3c4102d1311a62] => Array ( [product_id] => 6803 How do I get the product_id only? I tried $test = $cart_item['data']; pr...
Kevin.a
1

votes
1

answer
47

Views
1

votes
1

answer
50

Views

Memory Impact on Sending Binary File through HTTP PUT in PHP without multipart/form-data

I recently wrote a code where I send a normal PUT request which has contents of a binary file in the request body with the Content-Type header set to the mime type of said file. In the server, I handle that by just reading the raw request body in a variable, employing some validation: size (using st...
cipher
1

votes
0

answer
117

Views

Woocommerce Bookings Product Available Between Two Timestamps

I'm trying to see if a woocommerce booking timeslot is available bewteen two times. For example, I have a bookable product that is available 9:00am - 9:15am 12/27/17, when passing the unix timestamp for 9:00am 12/27/17 and 9:15am 12/27/17 i should receive true, else false. I've tried wc_bookings_ge...
Viking Mann
1

votes
3

answer
87

Views

PHP simplify json array by removing empty keys

I need to get data from an array, but the output always varies so sometimes it has more empty keys etc. $id = '1'; $url = file_get_contents('http://example.com/?api={$id}'); $json = json_decode($url, true); foreach($json as $data) { echo $data[0][0]['test']; } The problem is that to print values fro...
P. Nick
1

votes
1

answer
50

Views

Track conversions of HubSpot Landing page while using 3rd party Form

My company has been using HubSpot for leads and registrations. We recently integrated HubSpot with Salesforce and the integration has caused issues due to HubSpot deduping. Many of our customers are employees of hotels who move around to different hotels or work for multiple hotels at the same time,...
Travis Little
1

votes
0

answer
56

Views

How to send email from php using godaddy credentials

I'm using the below code for sending email I'm facing the below error in my Log file [Wed Dec 27 22:46:25.893118 2017] [:error] [pid 3047] [client 127.0.0.1:35984] PHP Warning: require_once(Mail.php): failed to open stream: No such file or directory in /var/www/html/testmail.php on line 3 [Wed Dec...
Krishna
1

votes
0

answer
42

Views

Replace attributes values in a XML with php

I have the next XML NOTA And I need to replace all attribute values with uppercase letters by values with the following JSON { 'CODIGOIMPUESTO': '1A', 'TEXTOMONEDA': 'MXP', 'EMISORCORREO': '[email protected]', 'EMISORNOMBRE': 'IVAN SANDER SANDER', 'CODPPROVEEDOR': '6001005599', 'CORREORECEP': 'tes...
Omar Sanchez
1

votes
0

answer
245

Views

How to pass FormData with Angular to Laravel action method

I have an existing site built using Laravel. I am 'duplicating' the action methods to use Angular, when I duplicated the action that posts a file I didn't get it to work. The $_FILES and $_POST global variables are not being set. Template: I have an input of type file, when a file is selected I wan...
Diego Alves
1

votes
0

answer
39

Views

PHP File backup excluding folders

I want to take backup of my website files and want to exclude some folders/files. I looked for a solution in an older post and tweaked a bit as described below:
Hitesh
1

votes
1

answer
439

Views

How to get the value of the number of posts per page in the function.php file?

From Wordpress I get data on the number of posts per page $posts_per_page global $wp_query; $args = array( 'post_type' => 'post', 'category_name' => $categories, 'posts_per_page' => $posts_per_page, ); $posts = new WP_Query( $args ); How now to get this number in functions.php? wp_register_script( '...
wasterel
1

votes
0

answer
130

Views

Laravel - How can I authenticate users from cached user object in Laravel? (using JWT)

I'm using the Laravel Tymon package for JWT user authentication. I'm also caching every user object after a new user is created and saved in the database so that I can load the data faster on selects. The authenticate() method in the Tymon package takes the token as an input and uses the user model...
Ryan
1

votes
2

answer
35

Views

Having trouble with less than(<) operator in php preg_match_all

I'm trying to parse a query string and have run into something I can't quite figure out. Trying to match a string that can contain either < or >, but I'm seeing some weird output only when the string contains a Returns as expected: Array ( [0] => Array ( [0] => wt>f ) [1] => Array ( [0] => wt>f )...
Knut L
1

votes
1

answer
268

Views

Getting the wrong date from cell using PHPExcel

I'm using PHPExcel and trying to get the date values from the cells, but for some reason they give me the wrong date. $dt_column = $obj_sheet->getCell('A1'); $unix_date = PHPExcel_Shared_Date::ExcelToPHP($dt_column); $date = gmdate('Y-m-d 00:00:00', $unix_date); The file is in .xlsx format....
Theodor3gabriel
1

votes
1

answer
331

Views

Laravel using Arabic characters as query parameters

I'm testing my Laravel Lumen API with Postman, my controller retrieve data from database using url query parameter like below $router->get('/ByName/{contactGov}', '[email protected]'); My url in Postman is http://localhost/apitest/public/ByName/BGD and every thing works fine but when i use Ara...
Ali Adil
1

votes
0

answer
149

Views

JAVA SSLSocket keyStore and trustStore, bad certificat error

I’m currently writing a JAVA app that receive AJAX requests from a PHP server. I use sockets for this and it works fine with HTTP requests. But now I would like to do the same thing with HTTPs requests. So I created a keyStore using cert and RSA key of the website : openssl pkcs12 -export -in -in...
Florent Guibert
1

votes
0

answer
59

Views

Google Search console reporting Soft 404 for existing pages

I have recently made a new website. Now Google Search console is reporting Soft 404 for pages that actually exist. I didn't have this problems on the previous website that was server side rendered with PHP. The new website is React based and I believe this is the problem but I still haven't found t...
Nuno Santos
1

votes
1

answer
28

Views

How to get MS SQL Stored Procedure return value In PHP with PDO?

Simple example CREATE PROCEDURE [dbo].[InsertLoginInPHP] @login as nvarchar(50), @password as nvarchar(50), @resultOK as int, @resultnot as int AS BEGIN SET @resultOK = 10 SET @resultnot = 1 IF EXISTS (SELECT * FROM Users WHERE Login = @login) BEGIN SELECT @resultnot as return // 1 END ELSE BEGIN IN...
Afqan Haciyev
1

votes
0

answer
606

Views

kevent() reported about an closed connection error

we are using FreeBSD, nginx, php-fpm in our server for php (yii) application. Sometimes kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream... occured in server log file and website response reach time out. Service php-fpm restart...
jamilaghasiyev
1

votes
1

answer
109

Views

CodeIgniter - Update Database Record

I've done the coding of Update Database record in Codeigniter. Everything works fine but When I click the Save button database records won't update. Each time it's showing the old database records. I want to update the database records but what's wrong with this. I don't understand the missing thing...
Mehreen
1

votes
3

answer
57

Views

Is there a way to rewrite my urls without using mod_rewrite and .htaccess?

Is there a way to rewrite my urls from: http://www.website.com/notification.php to http://www.website.com/notification I dont have the permission to turn on mod_rewrite and our organisation doesnt want it either. Is there a way to realise this with php only? Thanks in advance
Khaled Tlili
1

votes
2

answer
49

Views

Summarize the same key name in php multidimensional array

I have an array like this: [0] => Array ( [id_station] => 2397 [hour] => 12 [data] => Array ( [cameraon] => 355654 [cameraoff] => 4532 [camerabroken] => 76745 ... ) ) [1] => Array ( [id_station] => 2399 [hour] => 13 [data] => Array ( [cameraon] => 3905466 [cameraoff] => 1672 [camerabroken] => 70780...
sontd
1

votes
2

answer
140

Views

What is the equivalent of PHP's mysqli_num_rows() in MongoDB?

Specification Database: MongoDB 3.4 Programming Language: PHP 7.1 Library: PHP library of MongoDB 1.2.0 Sample Code $result = $connection->db->collection->find($filter, $options); In MySQL, you do this: $number_of_rows = mysqli_num_rows($result); When trying things out and doing some research, I've...
Darren
1

votes
1

answer
28

Views

Strange behavior of phpexcel

When trying to get an Excel spreadsheet from php with phpexcel, strange characters are generated in the output if a constant definition (DEFINE (' var',' value') is added. My code header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename='theFile.xls''); he...
Jam
1

votes
0

answer
1.8k

Views

PHP session not working on docker

I am trying to set up a PHP application but something seems to be wrong with session handling. As you can see the configuration is quite standard. I checked the /tmp permissions from the container and got [email protected]:/# ls -ld /tmp drwxrwxrwt 1 root root 4096 Dec 28 08:03 /tmp I also checked...
Moby04
1

votes
1

answer
51

Views

how to compare n multiple sentences which are in array and get the common words using php using array_intersect and store the common words in an array

Hi friends am trying to compare n sentences in an array and get the common words which are present in more than one sentence. Here is sample $cars=('hello how','hello when','when you came',........,n sentences); array_intersect is used to compare 2 or 3 arrays which have exactly common words in all...
Shruti
1

votes
1

answer
763

Views

Laravel JWT Authentication without User Model

I'm trying to build a laravel application and API for mobile users in the same project. The main web is actually a backend of a website and require proper authentication that I have already implemented. And the api also need to authenticate but with different credentials (not user model from web). A...
AHSAN
1

votes
1

answer
67

Views

yii rbac acf multiple roles and params

So I have an action which I need multiple permissions to have access to. (for example manageUsers (admin) and manageCompanyUsers (company manager)) access behaviour in controller has rule like: 'allow' => true, 'actions' => ['index'], 'roles' => [ 'manageUsers', 'manageCompanyUsers' ], 'rolePa...
Herokiller

View additional questions