There is one student. This student is enrolling in classes. What I want is to list the classes where this student is not registered. My SQL query is like this. Where am I going wrong? Answer I had to assume your table structure and I hope I got it right. The classic approach would be with LEFT JOIN and IS
Tag: codeigniter
Joining Query with codeigniter Model
Please help me how can I get only response where activities.activity_id = response.activity_id? here is my CI_model My Activities table My Response Table My users table Answer Try with this: You need to add aliases to the tables in order to build a more simplified and ordered query, in this case the aliases are a, b and c. UPDATE: I
Ajax request from PHP don’t return me an Array
I’m trying to return an array from a PHP script in Ajax, however, it seems to not work, it returns me a string rather an Array. I’m using CodeIgniter Framework, there is my .php code : And there is my Ajax request : My getAll() function just select all from the database, however i’m only using the temperature & date
Counting Rows Includes JSON by Id in Codeigniter
We have one groups table name as “groups” (There is mail groups) We have one person table name as “person” (There is persons who has in mail groups) We saved person in the “person” table with json_encode by group ID. Because a person can belong to more than one group. The problem is we can not get count rows of
Can we fire a database query in config/constants.php file to make constants dynamic? (Php Codeignitor)
I have tried to place this at the bottom of the config/config.php but it is throwing this error: An uncaught Exception was encountered Type: Error Message: Class ‘CI_Controller’ not found Filename: E:xampp74htdocsjrvssystemcoreCodeIgniter.php Line Number: 369 Please suggest me some solution for this. If this is not possible then what else we can do to make constants dynamic? Answer constants.php is
How to get the last 7 weeks, 7 months date range from current date PHP?
How can I get the date range of last seven weeks /months from the current date, i have already done with last seven days fetch last seven days, weeks and month sales total grouped by 7 particular days, 7 particular weeks and 7 particular months ex: Last seven weeks Last seven Months The below query I have done for last
How to find out if variable value in database json column Codeigniter?
Im using Codeigniter. Im trying to get some value in database like; the problem is ‘json_value’ column is like = [{“name”:”test1″,”value”:”test1″},{“name”:”test2″,”value”:”test2″}] how can I get ‘test1’ if ‘json_value’ has? Answer You can use LIKE in your query For more information read the CI3 documentation.
can i use md5 hashed values inside $this->db->escape() in codeigniter,
when i tried to use md5 hashed values inside $this->db->escape() i’m getting error like below when i tried to fetch count of results “Call to a member function num_rows() on bool” my code Answer You are making double escape as i see it. Remove the single quotes from $this->db->escape(). Or the better way is to set the variables in the
How to loop multiple form input and assign into sql query in php?
Refer to comment in the function, how to achieve that output? the idea is, from the input POST i get which over 27 fields, i just want to fill in into the $sql query i prepared as you can see. I don’t think writing each table column manually is a good way. im using Codeigniter 4 php framework + postgresql.
How to use where condition in if statement which is already written in codeigniter
I have got a situation where the $user_id parameter is optional and I used to do this in codeigniter in the way written below. But I am not able to figure it out, How can I write this query in laravel’s eloquent and query builder as well. Any help is much appreciated. Thanks Answer Using Eloquent: Using Query Builder: Replace