Skip to content

Tag: php

PHP A Good way to pass the PDO Object into other Main classes

im new to PHP OOP, now i was woundering if there is a better way to use the Database Class then just extending it over all. For Example i am having 3 main classes: Employee, Customer, Article. each of this classes have a subclasses which extends form. what i have done until now is extand the Db class on each

Eloquent “where” on relationship returns wrong models

I have this method on my model “Employer”: I thought it would work fine, but it ends up giving me models that aren’t even related to my Model. Like, the id of the model is 37 and it gives me the relationships of all the models (like id 6). Any idea of why this would happen? Answer I think yo…

Add class on div using foreach if else Laravel

I have 5 items ( 3 items on first row & 2 items on 2nd row ) that loads something like this Here’s my sample blade code But what I’m trying to do is something like this By doing this I need to add a class named as ‘mid’ on this location Tried to use something like this But it

How to join data table to select newest record in sql

I have two separate table LPG_usage and devices. In the LPG_usage table has 5 columns as (Device_id,Cylinder_Type,Date,Kg,Data_index ) and the devices table has 3 columns as (Device_id,User_name,Location) I want to select newest record by considering the Date in the LPG_usage table for all of Device_id’…

PHP cURL Received HTTP code 407 from proxy after CONNECT

I have a php curl with proxy problem. Below is my code: The format of proxies in proxy.txt is ip:port:user:pass and all proxies are working. The problem is when I used $proxyipport and $proxyuserpwd in CURLOPT_PROXY and CURLOPT_USERPWD, the curl result threw the error Received HTTP code 407 from proxy after C…