I have the following address in CodeIgniter:
/movprod/countries/movies-produced-in-the-united-states-dh88075452
With pagination 'movies-produced-in-the-united-states-dh88075452' is removed:
/movprod/countries/10, for example
what causes error because I need the last 4 numbers (id of the table) to get the data from the database.
How do I keep the link?
Codeigniter pagination has many configs, one of them is the segment which it will take as number of page, by default is "3" you need to change it to "4".
in the pagination config use:
$config['uri_segment'] = 4;
As you can see here:
https://ellislab.com/codeigniter/user-guide/libraries/pagination.html
Related
Let's imagine we have a web-page with the content and one of the elements is table where we have couple of columns. It is done with Joomla, so basically I am working with the web-page constructor if I can call it like this and not with code. In the last column I have a link with query parameters, so something like this: link?qparam1=sth1&qparam2=sth. The values for these query parameters should be taken from the first and second column and inserted in this link. Otherwise I need manually to copy those values to each and every link which makes in very slow and inefficient especially when table values are changed, the link must be updated as well.
Is it possible to fetch the data from columns and include into the link?
Write a system plugin, Get data from a table, insert/update data to request
$app = JFactory::getApplication();
$app->input->set('qparam1','<value from table>');
it will update request data.
I have table in mysql with 20000 records.
How can I retrieve data faster?
I used datatable plugin for pagination and I also use codeigniter.
It took about one minute to split records to about 4000 page
please use pagination [ci Pagination, php pagination, jquery pagination ajax(faster than others) ] if you are using bootstrap datatable its not working because datatable fetch all the data in one hit after that it breaks data on view which is time consuming you need to break the data in small groups like 20-20 or 50-50 and you need to fetch data in every hit of pagination numbers.
if you are usign ci pagination it will reload on every page hit however if you are using jquery pagination it help you to fetch data in every number hit without refreshing the pages.
please go through the following link: https://phppot.com/php/ajax-pagination-with-php/
in order to implement ajax pagination.
Create view and load table headers
add id on tbody
start ajax pass number want to break = 50, and page = 1
send those value to controller and fetch data as per page.
in your modal you need to add limit and offset which will revised on every hit of pagination number.
how to retrieve data from db for registation on laravel?
I have two tables database, users and kode_instansi, I want to continue at the time of registration there is a form select that displays all data from the table kode_instansi. help master
Controller:
View:
Please follow the official documentation of laravel5. This page will clearly help you in retrieving results from DB.
The page clearly explains the different ways to retrieve data:
Retrieving All Rows From A Table
$users = DB::table('users')->get();
Here users is the table and this particular query would get you all the data from the users table.
Similarly,
Retrieving A Single Row / Column From A Table
$user = DB::table('users')->where('name', 'John')->first();
I would also suggest you to configure the database in order to use the database in laravel. Please perform this step initially.
How can I get the image url stored in my database and render it on the page in laravel 4?
Very vague question, so will be the answer. Please clarify if it's not what you need.
Assumptions: You have an Item model that is stored in a DB. In the relevant controller method you add the code below which will find the item with id 1 and will display the field named "url".
$item = Item::whereId(1)->first();
echo $item->url;
I'm using the default paginator to add the pae offset to uri(3) and the sort data is put in and associative array to uri like this in the table headers
echo anchor("/contact/index/$paging/".$this->uri->assoc_to_uri($assoc),$column);
at the moment i can sort desc and asc by clicking on the headers, but when i want to cycle through the pages it'll only put the page offset in uri(3) but i want to add and additional assoc into the page links.
at the moment the paginator links are made like this
$this->pagination->create_links();
but i would like to be able to add an additional assoc to each page link
$this->pagination->create_links($this->uri->assoc_to_uri($assoc));
like this.
I've had to make changes to the paginator library, so i've extended it.
i've called it paginatorsortable
http://gist.github.com/649102