Skip to content
Advertisement

How to count no of row with like command in Codeignighter

I have tried this code for count rows

JavaScript

and it gives me an error

JavaScript

Advertisement

Answer

Use num_rows() to count function, because $count is an array (if not null):

JavaScript

Or

JavaScript

Security note

Before sending $search_data direct to SQL query, make sure you use $this->input->post to catch and clean from SQL injection.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement