Welcome Guest, Not a member yet? Register   Sign In
  How to Find & Hire Codeigniter Developers in 2024
Posted by: php_rocs - 05-09-2024, 06:52 AM - Replies (3)

An encouraging and interesting read. https://www.developersforhire.com/codeigniter


  6 hard truths about learning to code in 2024 (DEV.TO)
Posted by: php_rocs - 05-09-2024, 06:27 AM - Replies (2)

True indeed. https://dev.to/educative/6-hard-truths-a...n-2024-ppj


  I built 30 startups in 20 years (DEV.TO)
Posted by: php_rocs - 05-09-2024, 06:26 AM - Replies (1)

Very useful read. https://dev.to/johnrushx/i-built-30-star...years-3j41


  Insert in joint table before inserting in another one
Posted by: kcs - 05-09-2024, 04:45 AM - Replies (13)

Hi,
I have a model for bookings linked to clients (it uses clients.id to join to the clients table).
I am working on an admin form to create new bookings. I use an autocomplete on the client name, that allows the admin to select an existing client from the clients table.
When a client exists already and the user clicks on a suggestion from the autocomplete, I send its client_id as value to a hidden field that will be used in the insert for the new booking.
That works perfectly, but I am struggling now with the scenario when there is no existing client, so the user types in the new client name, the client_id field is empty, and when I post the form, I need to first create the client, get its new id, and then create the booking using that new client_id.

I remember seeing something in the docs related to before/after actions, and I am thinking that maybe I should have in this case a createClient function that has a callback to the createBooking one. But I can't figure it out.
Can someone point me to the right direction?


  Get date from datetime fielld
Posted by: pippuccio76 - 05-08-2024, 12:03 PM - Replies (1)

hi ,
i want search events for a date selected (YYYY-MM-DD)  this is my query , in db's table i have datetime field:

Code:
     $lista_eventi_utente = $event_model ->where(SUBSTRING('start', 0, 5),$date)
                                         ->where('id_users',auth()->user()->id)
                                        ->findall();


but have error in  SUBSTRING , how can i get date from datetime?


  Protect certain pages in Shield?
Posted by: frocco - 05-08-2024, 07:20 AM - Replies (2)

Hello,

What do I need to configure in Shield to allow browsing of my website before logging in?

Do not allow certain paths like cart unless they login.

Thanks


  CodeIgniter 3 to 4 migration - hash encryption
Posted by: hqualit - 05-07-2024, 11:31 PM - Replies (1)

I am in the middle of the migration to CI4 from CI3. In CI3 version we have used the below method on user registration and saved $salt and $password in the db.  $salt     = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), TRUE));

$salt    = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), TRUE));
$password = hash('sha512', $data['password'] . $salt);
When user login we have used the below method. 
$results = $query->getRowArray();
$salted_password = hash('sha512', $password . $results['salt']);
 if ($results['password'] == $salted_password) { return true; }
The same code used in CI4 too.
But the login is giving password mismatch with the existing users credentials. But it works totally fine with the new registered user. Do anyone has idea how I should change this code to work with the existing users' credentials?


  CI NEEDS A PROPER DOCUMENTATION
Posted by: luckmoshy - 05-07-2024, 10:44 PM - Replies (9)

Yes Hi, I think it is time that CI needs a useful and good explanation in its document description. There are very different things you find where the truth is false and where there is a lie. It is necessary to write it properly or rewrite its description. It looks like this: Services::response()


  Issue with Model Validation
Posted by: osawayn - 05-07-2024, 07:18 PM - Replies (1)

When using the Model validation features in CodeIgniter 4, I'm finding that some of the validation rules aren't working as expected. For instance, the "required" rule doesn't seem to be triggering the expected validation error when the field is left empty. Additionally, the "valid_email" rule also doesn't appear to be validating the email format correctly.

Steps Taken:
1. I've verified that the validation rules are correctly defined in the model.
2. I've confirmed that the fields being validated are present in the form submission data.
3. I've reviewed the official documentation and compared my implementation with the examples provided.

Code:
// Sample validation rules in the model
protected $validationRules = [
    'email' => 'required|valid_email',
    'username' => 'required|min_length[5]'
];
I'd appreciate any guidance or advice on how to troubleshoot and resolve this issue. Has anyone else encountered similar problems with model validation in CodeIgniter 4? Any pointers on best practices or potential pitfalls to watch out for would be immensely helpful.

Thanks in advance!


  Gateway time out CI 4.4.1
Posted by: adleon73 - 05-07-2024, 01:35 PM - Replies (5)

I have a project made on Codeigniter 4.4.1 + MySQL

The setup is:

Routes.php

PHP Code:
$routes->get('admin_start',  'Admin::index');
$routes->get('admin_ejercicios',  'Admin::admin_ejercicios');
$routes->get('admin_rutinas',  'Admin::admin_rutinas'); 

Controller: Admin.php

PHP Code:
<?php

namespace App\Controllers;
use 
App\Models\Admin_model;
use 
App\Models\Admin_users_model;

use 
App\Controllers\BaseController;


class 
Admin extends BaseController
{

    protected $helpers = ['form','url','html'];

    public function index()
    {
        $data['content_view']="admin/admin_users_view";
        return view('admin/admin_main_view',$data);
    }

    public function admin_ejercicios()
    {
        $data['content_view']="admin/admin_ejercicios_view";
        return view('admin/admin_main_view',$data);
    }

    public function admin_rutinas()
    {
        $user_id    =$this->request->getGet('id');

        $admin_model= new Admin_users_model();
        $user_name=$admin_model->get_username($user_id);

        $data['user_name']=$user_name;
        $data['user_id']=$user_id;
        $data['content_view']="admin/admin_rutinas_view";
      
        
return view('admin/admin_main_view',$data);
    }



.htaccess

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>


Switching between these controllers:

http://192.168.1.167/gym/admin_rutinas?id=70

or

http://192.168.1.167/gym/admin_ejercicios

or

http://192.168.1.167/gym/admin_start

I get a 504 Gateway timeout error after 5min waiting for response

On the browser console the call is shown as pending, and never throws an error.

I tried to change max_execution_time on PHP to 0 or -1 and I have the same behaivour

The database has only a few records, so I don't think it is due to a long response from the server.

I'm also having the same behaivour on my hosting.

Could it be something related with the framework?, or it is just my code?


Thanks.


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
how to use set_select on ...
by kcs
1 hour ago
CodeIgniter Tasks - Regis...
by ltarrant
2 hours ago
Mastering SQL: Comprehens...
by InsiteFX
3 hours ago
Call multiple function in...
by warcooft
4 hours ago
Call to undefined functio...
by nanohe
7 hours ago
Query Builder Conditions ...
by kenjis
7 hours ago
Create a copy of file fro...
by Ege
Yesterday, 04:01 PM
How to use Amazon PHP SDK...
by asimeou
Yesterday, 10:53 AM
fatal logger emergency
by kenjis
Yesterday, 03:39 AM
Array to HTML "Table"
by Bosborne
Yesterday, 03:28 AM

Forum Statistics
» Members: 87,676
» Latest member: betcompanywin
» Forum threads: 77,650
» Forum posts: 376,395

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB