Skip to content

assigning variables to sql query result

Amateur here, just practicing some sql. I am trying to assign php variables to my sql query results, and I thought I saw it work in this fashion, but it doesn’t seem to be working for me: $query1 = …

Get properties of a pdf file by using PHP

I have on pdf document. I want to print the details of pdf like page size by using php. I have this code This is my code can any one help regarding this. Thanks in advance Answer First check your pdfinfo’s path, if you don’t have it: XPDF… so then change your code: If you use Linux: $pdfinfo…

Nest JSON from MySQL using PHP

I have a MySQL query which returns the following table: and I have to return, via PHP, a formatted JSON which looks like the following: Basically, I need to nest the invitations inside each event. Answer Try this.

PHP Split html string into array

I hope I can get some help from you guys. This is what I’m struggling with, I have a string of HTML that will look like this: I need to split all the <h4> from the rest of the content, but for example the content after the first <h4> and before the second <h4> needs to be related to th…

laravel controller is not instantiable

Im calling my controller in routes.php: Route::get(‘request’, ‘Controller@request’); In my controller is the method request: class Controller extends BaseController { public function request() …

Cakephp Auth->user() null

In my CakePHP app, I want to include a login form on every page with a login button if the user is not logged in and a logout button if they are logged in. Here is my Auth configuration in AppController.php I want to set a flag that is usable in all the views to check if the user is

Laravel 5 how to get route action name?

I’m trying to get the current route action, but I’m not sure how to go about it. In Laravel 4 I was using Route::currentRouteAction() but now it’s a bit different. I’m trying to do Route::getActionName() in my controller but it keeps giving me method not found. Answer In Laravel 5 you …

Laravel belongsTo returning null when using ‘with’

I’m just getting started with Laravel so please forgive any noobness. I have a User and Order model, a user has many orders: So I think I have the above right. But when I do this: I get Call to a member function addEagerConstraints() on null. However, if I do it the other way around, it works great: Wha…