Skip to content

Tag: php

hasManyThrough laravel relation

I have three table below. hasManyThrough in Country::class model to get all products. I want products which are related to countries or one country: Answer The relation you’re describing best suits a many to many, which is usually written in Laravel as a belongsToMany on both sides. If you stick to Lara…

PHP not reading $_GET parameter when sending an AJAX request

I’ve been struggling with this since months, and finally got to the point I need to fix it on my project. The thing is, I’m sending an ajax request to a php file where I need to read the current $_GET[‘user_id’] value in order to insert a query. But php just won’t read $_GET[&#82…

PHP’s openssl_sign Equivalent in Node JS

I am (slowly) learning Node JS and trying to use it in place of a PHP script I have. I need to sign a string I have assembled with SSL to pass on to a curl request. In PHP, this is how I’ve done it: So I’m trying to generate the evuivalent of $signed_signature, but I’m not sure how to

use of array in php

How can I use array outside of the foreach loop so that it gives the same result? foreach($rows as $row){ $s = array($row[‘sub_name’]); $m = array($row[‘mark_obt’]); $show = array_combine($s,$m)…

Select active data by order

I have 2 tables posts and categories, There is one-to-many relation between both tables. Here are the two tables: There is a relation between category_id and c_id, So that the category_id in the posts table refers to the category id c_id. The post_order and c_order are used to order both posts and categories.…