New answers tagged codeigniter-3
0 votes
How to declare a model method in MY_Model (from CI_Model) then allow its extending models to call that method in CodeIgniter
Having contextual models extend MY_Model which extends CI_Model has really practical benefits and this is exactly how my largest CodeIgniter application is designed (it wasn't a decision that I ...
0 votes
SELECT rows WHERE a JSON column contains a specific property value using CodeIgniter's query builder
It's a bit cumbersome to try to shoehorn JSON accessing syntax into a WHERE clause building method because the ->> fools with CodeIgniter's parsing of the expression. Ultimately, to keep using ...
0 votes
Passing multiple column names to CodeIgniter's select() only returns a result set containing the first nominated column
Your Model: Because your method returns potentially multiple posts, your method name should use plural grammar - getPosts. The select() method has just two parameters. select($select = '*', $escape = ...
0 votes
SELECT next and previous id relative to a searched id from a table with gapped ids using CodeIgniter's query builder
The "entirely" query builder version of your raw SQL is: public function getPrevNextRow(int $id): ?object { return $this->db ->select([ sprintf( ...
0 votes
SELECT SUM() of values in a single column for rows with a timestamp from last month with CodeIgniter's query builder
CodeIgniter's query builder can support what you need. Prepare the date range boundaries in PHP and the summing query will perform well. I never recommend using false as a fallback return value from a ...
0 votes
Get values from array inside another array for later storing them in db
$this->input->post('address') will return the array of numerically keyed rows. Simply loop over that payload and write your model method calls inside of that loop. Controller: $rows = $this->...
0 votes
CodeIgniter gives "No tables used" error when get() is called after get_compiled_select()
You are calling $this->db->get_compiled_select() as a what seems to be a debugging step. That method will return the build query as a string and then reset the query builder cache. To prevent ...
0 votes
SELECT rows with datetime value in the next 2 days using CodeIgniter's query builder
Your query involves only one table, so there is not need to qualify the table of origin when you mention columns. select('*') can be safely omitted because that is default behavior of a SELECT query ...
0 votes
CodeIgniter's field_field() list is fetching table field names from all schemas instead of just one
My CodeIgniter 3.1.13 project does not have a method called field_list(), but it does have field_data() which returns an array of objects with the following properties: name, type, max_length, default....
0 votes
Autocomplete issue in append html
First problem is in your backend code that you are directly using the SELECT * statement query and accessing the data as item.data but there is no .data from back-end. So you can modify your ...
Top 50 recent answers are included
Related Tags
codeigniter-3 × 5291php × 4047
codeigniter × 2696
mysql × 655
jquery × 328
ajax × 307
javascript × 261
codeigniter-2 × 228
html × 197
session × 149
.htaccess × 133
arrays × 94
json × 93
database × 92
sql × 85
file-upload × 75
email × 60
validation × 59
routes × 59
model-view-controller × 56
mysqli × 55
query-builder × 53
forms × 52
codeigniter-query-builder × 52
hmvc × 50