php

How to send input from HTML Form and use it in php CURL function

陌路散爱 提交于 2021-02-19 08:07:31
问题 I'm new to web programming and I was looking to find the solutions on the internet but I get stuck, so anyone can help me I would appreciate his effort very much. I have two files. The first file is an HTML form like this. <html> <title>index.html</title> <body> <form action="index.php" method="post"> Title <input type="text" name="title" /> <br> Cat <input type="text" name="cat" /> <br> Private <input type="text" name="private" /> <br> Description <textarea name="description" rows="10" cols=

Php regex: remove order by from query string

老子叫甜甜 提交于 2021-02-19 08:06:12
问题 I have a php method, which should remove all occurences of an "order by" mysql statement from a mysql query string. Example 1: STRING: SELECT * FROM table ORDER BY name RESULT: SELECT * FROM table Example 2: STRING: SELECT a.* FROM (SELECT * FROM table ORDER BY name, creation_date) AS a ORDER BY a.name Result: SELECT a.* FROM (SELECT * FROM table) AS a My question now is: How to achive this. I have tried the following: if (stripos($sql, 'ORDER BY') !== false) { $sql = preg_replace('/\sORDER\

How to update page content while multiple users view it at the same time in PHP?

こ雲淡風輕ζ 提交于 2021-02-19 08:03:08
问题 My page is visited by multiple users at the same time. User 1: visits the page and changes the name of title User 2: user 2 was already on that page but sees the old title, the title automatically has to be updated to new title. I know i can simply use AJAX to call every 5 minutes , but im trying to see if there is any other way possible that fires an event to all instances of the page opened by different users that if one of them is updated all other pages get automatically updated with

CakePHP: upgrade from 3.6.x to 4.0 “Missing Template Exception”

天涯浪子 提交于 2021-02-19 07:55:30
问题 I followed the upgrade guide (after I upgraded from 3.6 to 3.8 ) but I get this error: Error: [Cake\View\Exception\MissingTemplateException] Template file "Error\error500.ctp" is missing .... If you want to customize this error message, create src\Template\Error\fatal_error.ctp After the upgrade procedure my templates moved to app_name\templates directory and renamed to *.php instead of *.ctp . I updated the app.php and app.default.php with the new paths: 'App' => [ 'namespace' => 'App',

laravel orm : where condition on table -> related table -> related table

倾然丶 夕夏残阳落幕 提交于 2021-02-19 07:54:25
问题 so here is my database for a book store books : id ,title category : id, title book_category : id , book_id, category_id book_stock : id , book_id , quantity , price considering all the relations are defined in the model , i can query book_stock it goes something like this Stock::with('Book')->get(); but what if i want to get stock of a book in the category = 1 i can use use condition on book Stock::with('Book' , function($q){ $q->where(['title'=>'abc']); })->get(); but how can i filter

send POST request in PHP to pushbullet API 401 error

折月煮酒 提交于 2021-02-19 07:52:08
问题 I'm trying to send simple push notifications with pushbullet just through using the email and sending those to the linked account to avoid needing account data. (see reference here: https://docs.pushbullet.com/#pushes) Therefore I'm using a non cURL-method in php that I (not only) found here: How do I send a POST request with PHP? Unfortunately I get back an error as following: <br /> <b>Warning</b>: file_get_contents(https://api.pushbullet.com/v2/pushes): failed to open stream: HTTP request

Laravel eloquent withCount() supposed to be slower than just with()

孤街醉人 提交于 2021-02-19 07:51:25
问题 So the reason i ask this is that in my current app withCount() almost triples the response time vs just fetching all the data for the relationship via with() and just getting the length from the frontend (javascript). I thought the point of using withCount() was to speed up the query but maybe i'm wrong? for example: courseSession::where('id', '>=', 1) ->where('id', '<=', 320) ->withCount('enrollments') ->get(); averages around 900ms response (debugbar shows this as a single DB call) but

send POST request in PHP to pushbullet API 401 error

倾然丶 夕夏残阳落幕 提交于 2021-02-19 07:51:02
问题 I'm trying to send simple push notifications with pushbullet just through using the email and sending those to the linked account to avoid needing account data. (see reference here: https://docs.pushbullet.com/#pushes) Therefore I'm using a non cURL-method in php that I (not only) found here: How do I send a POST request with PHP? Unfortunately I get back an error as following: <br /> <b>Warning</b>: file_get_contents(https://api.pushbullet.com/v2/pushes): failed to open stream: HTTP request

An unexpected error occurred. Something may be wrong with WordPress.org

房东的猫 提交于 2021-02-19 07:45:34
问题 I was not able to install plugins in my WordPress site. I am getting the following error when i try to install a new plugin.But its allowing me to upload a plugin and then to install it. "An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums." 回答1: After spending more time is this I have resolved this by looking at wp-config.php Make sure this flag is false, if it's true update

Array to CSV file for vertical layout and failed to put the header row

会有一股神秘感。 提交于 2021-02-19 07:45:07
问题 I have a problem to create a horizontal layout for the csv here is an array which I have convert it to json-format {"datetime":["2000-01-01","2000-01-02","2000-01-03","2000-01-04","2000-01-05","2000-01-06","2000-01-07","2000-01-08","2000-01-09","2000-01-10","2000-01-11","2000-01-12","2000-01-13","2000-01-14","2000-01-15","2000-01-16","2000-01-17","2000-01-18","2000-01-19","2000-01-20","2000-01-21","2000-01-22","2000-01-23","2000-01-24","2000-01-25","2000-01-26","2000-01-27","2000-01-28","2000