2018-10-22         Andrew

CodeIgniter - How do I do Pagination?

I've look through lots of question asked about Pagination but I can't really understand how Pagination works. I need Pagination to work on index() and when user enter date range searchdate().In my Controller:public function __construct() { parent::__construct(); $this->load->model('ReportModel');}public function index(){ $orders=new ReportModel; $data['data']=$orders->get_orders(); $this->load->view('includes/header'); $this->load->view('Report/view',$data); $this->load->view('includes/footer');}public function searchDate(){ $orders=...

 php                     2 answers                     30 view
 2018-10-22         Mirabelle

Get total of the column with where condition

I am trying to get the total of the column Price with condition BillPaid column value should be 0. My code block is public function countDue(){ $getTotalDue = DB::table('ordered_books') ->where('BillPaid', 0) ->sum('Price') ->get(); return response()->json($getTotalDue); return compact('getTotalDue');}controller code block for calling the countDue method.public function create() { return view('pages.booksin', $this->countDue());...

 php                     3 answers                     38 view
 2018-10-22         Francis

Laravel: Jasper reports in laravel lumen5.6

I already implemented jasper reports with laravel and it works fine for me. Now i shifted to laravel lumen for api building so i try to integrate jasper as same as i integrate in my laravel projects but in laravel lumen it throws some error as below:- Call to undefined method Laravel\Lumen\Application::booting()below is my connection code class_alias(JasperPHP\JasperPHPServiceProvider::class,'JasperPHP'); $app->withFacades(); $app->withEloquent(); $app->register(App\Providers\AppServiceProvider::class); $app->register(App\Providers\AuthServiceProvider::c...

 php                     1 answers                     39 view
 2018-10-22         Lindsay

Laravel Belongsto many relationship with additional column

I have been facing a problem in my project. I have a belongsto many relation with additional field.For example I have two table User and Social table and a pivot table named social_user. Here my user model ispublic function socialinfos() { return $this->belongsToMany(Social::class)->withPivot('id')->whereNull('deleted_at');}And my social_user table is Schema::create('social_user', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('user_id'); $table->string('social_id')->nullable(); $table->string('url')->...

 php                     1 answers                     44 view
 2018-10-22         Rachel

Laravel 5.6 session not redirect to view

I'm using Laravel 5.6 and facing some problems. I want to authenticate a User if email and password found in Database match then redirect. If the User exists, redirect to "user1", otherwise redirect to "/": also atttached the Migrations fileRoutesRoute::any('/user1','UserProfile@store');Route::get('/login','StudentController@index');Controllerpublic function store(Request $request){ $info = array( "Email" => $request->get("email"), "password" => $request->get("password") ); $info = DB::table("students")->where($info)->first(); if...

 php                     1 answers                     54 view
 2018-10-22         Sarah

Multiple microsites will login as one

I have multiple microsites:https://www.samplesite.comhttps://subdomain2.samplesite.comhttps://subdomain3.samplesite.comhttps://subdomain4.samplesite.comhttps://subdomain5.samplesite.comOnce I login to one of these, it should also automatically create a logged session for other microsites just like GOOGLE.How can I do this? Any ideas?As I know, session is individually created for each domains and is certainly not readable for other domains. P.S. I am using codeigniter as framework. You should be searching the keyword "Single Sign-On". There are many ways to do it. But ba...

 php                     1 answers                     78 view
 2018-10-22         Guy

XMLHttpRequest, Access-Control-Allow-Origin error

This question already has an answer here: XMLHttpRequest cannot load XXX No 'Access-Control-Allow-Origin' header 6 answers While you did not mentioned which server are you using, here's two links about how to configure the Access-Control-Allow-Origin header on popular HTTP Servers.CORS on ApacheCORS on nginxPlease note: you wouldn't like to use *, but you might want to properly configure your server to enable this for known hosts only. [XXX]

 php                     1 answers                     45 view
 2018-10-22         Evan

Symfony 4 multiple file upload TransformationFailedException

I have a React app with Symfony 4 on the back-end throwing the above exception.I've attempted to follow this post (in French).On Symfony's profiler, Form, I can see both files, each with its own error. Excerpt follows:This value is not valid. 0 Caused by:ConstraintViolation {#993 ▼ root: Form {#792 ▶} path: "children[attachments].children[0]" value: UploadedFile {#36 ▼ -test: false -originalName: "alfa-romeo-4C-1.jpg" -mimeType: "image/jpeg" -error: 0 path: "/Applications/MAMP/tmp/php" filename: "php0vUzd5" basename: "php0vUzd5" pathname: "/Applications...

 php                     1 answers                     73 view
 2018-10-22         Ina

Selecting items with join and without foreign key

I have query which gets each user's record from blacklist table and relations to them from rules table.It looks like that:$result1 = DB::table('blacklist') ->join('rules', 'blacklist.rule_id', '=', 'rules.id') ->select('blacklist.*', 'rules.clicks', 'rules.minutes') ->groupBy('blacklist.address') ->where('blacklist.user_id', JWTAuth::user()->id) ->get();However I set field blacklist.rule_id as CAN BE NULL. Above query doesn't get records which have blacklist.rule_id == null(only these with values).I have second query for ...

 php                     2 answers                     83 view
 2018-10-22         Afra

Read config value from laravel helper

This question already has an answer here: Reference - What does this error mean in PHP? 31 answers current() is an existing function http://php.net/manual/en/function.current.php [XXX]

 php                     1 answers                     84 view
 2018-10-22         Morton

why this always return empty array

this is my query code for searchif ($request->has('search')){ $search = $request->get('search'); $households = Household::where('data->household_id', 'LIKE', '%$search%') ->orWhere('data->data->household->address', 'LIKE', '%' .$search .'%') ->orWhere('data->data->members', 'LIKE', '%' .$search.'%')->get();} else { $households = Household::all();}if ($households){ return response()->json([ 'error' => false, 'data' => HouseholdResource::collection($households), ], 200);}return "...

 php                     1 answers                     85 view
 2018-10-22         Chloe

PHP continues loop inside loop

I have a repeated row which have 5 columns. I want when every time row is looped column data is looped number but continues after every loop. Sample code:$list = 0;$list++;for ($i = 0; $i < 5; $i++ ){<div class="row"> <div class="col-2">$list</div> <div class="col-2">$list</div> <div class="col-2">$list</div> <div class="col-2">$list</div> <div class="col-2">$list</div></div>}Sample result what i want:<div class="row"> <div class="col-2">1</div> <div class="col-2">...

 php                     3 answers                     95 view
 2018-10-22         Ronald

Add all duplicate values in mysqli

I have an tabel trade as following:- bm | m | price | amount | status USD|BTC| 0.01 | 1 | active USD|BTC| 0.01 | 2.5 | active USD|BTC| 0.4 | 0.5 | active USD|BTC| 0.4 | 0.22 | activeI want to add amounts of duplicate price i.e 0.01 and 0.4 where status is active and show them so that the result is like:- price | amount 0.01 | 3.5 0.4 | 0.722I have tried an php query for showing but it shows values and rows as it is. Help please. Simply do a GROUP BY, use SUM() to calculate the sum for each price!select price, sum(amount)from tablenameWHERE bm = 'usd...

 php                     1 answers                     96 view
 2018-10-22         Richard

How to create language select in twig template

I'm currently using symfony 3.2. and now i have a link like this :http://link.com?lang=en and in config/parameters I have allowed_locales -en, -ruHow could i create a language switcher in twig template like this : <a href="#" class="locales">EN<img src="{{ asset('assets/images/arrow-down.svg') }}" alt="arrow" class="arrow-down" /></a> <div class="locales-content" style="left:0;"> <a href="#">Russian</a> <a href="#">English</a>...

 php                     1 answers                     98 view
 2018-10-22         Cora

Embedding html in php unexpected <' error

This question already has an answer here: PHP parse/syntax errors; and how to solve them? 14 answers As I said in comments, you're injecting pure HTML into PHP.You have to close off the PHP tag, then reopen.The <html> tag in this <html> file_put_contents and related </html> needs to be removed also.There should probably be a trailing slash for /file/location if that gives you a problem, but might not be needed, it's just a side note here.<?php $file = fopen("/...

 php                     2 answers                     99 view
 2018-10-22         Herbert

How display (hierarchical) years and months of my articles creating (PHP, Yii2)?

I have articles table in my DB: id(int), title(varchar), text(text), created_date(date)I need display all months and years of articles creating with count of articles like this:2018Jan (5)Mar (7)Jul (5)Dec (1)2017Feb (12)Sep (3)2016 Aug (13)Sep (6)Nov (2)How can I do this with Yii2? Hi I dont now how to do this in yii but the basic query to access to this data ,It would be something like this.First execte this SQL query SELECT YEAR(created_date),MONTH(created_date), COUNT(id) TotalCountFROM articlesGROUP BY YEAR(created_date), MONTH(created_date);This will return you a...

 php                     1 answers                     68 view

Page 1 of 7084  |  Show More Pages:  Top Prev Next Last