2
votes
2answers
54 views

Creating complex IF, OR, NOT & AND SQL queries (MySQL)

(Apologies if this a duplicate - I have tried searching, but I may not know the right word for what I'm trying to achieve - feel free to correct me!) The Background So I have a PHP based app ...
0
votes
1answer
44 views

SQL, SELECT items which specific date is not booked

I have items list. Every single item may be booked for specific date, eg. 2013-01-03 00:00:00, 2013-06-13 00:00:00 etc. I have to filter items in way that shows available items for choosen date. If ...
0
votes
1answer
34 views

mysql returns empty rsult set when searching for a string containing asterik sign

I am not sure if the problem I have with the my search function in my system is really what I claimed in the title of this post but I am confused a little bit in this. I have a search box that ...
0
votes
2answers
28 views

Codeigniter Extracting Data From Database With Function

I have to extract two separate pieces of information from my mysql database. I'm having a hard time trying to figure out how to extract two different sets of information via function(s) I'm writing. ...
0
votes
0answers
21 views

codeigniter: pagination edit query

i have my pagination Controller: $this->load->library('pagination', TRUE); $conf['base_url'] = "http://localhost/projecto/index.php/produto_serv_c/list_produto_serv"; ...
0
votes
1answer
52 views

Codeigniter / PHP, 2 Mysql Tables, Multiple Queries

I have 3 tables 1 is an item table, one is a note table and the other is a note image table. When a user views item details, all notes are picked up for that item (there is a item_id field in the ...
0
votes
1answer
36 views

codeigniter too many model queries within controller

I didn't find a similar topic, so I'm asking: How to get over the problem of repeating the same model queries for all my CodeIgniter controller functions? For my site, I have to build my header and ...
0
votes
2answers
38 views

CodeIgniter - Query array output three times instead one

Output is wrong , i Got three the same comment instead only one. Can anyone help to make only one comment. Here my view php code: $modelid = "5" ; $query = $this->db->query('SELECT message ...
0
votes
2answers
31 views

Codeigniter - Query inside foreach

So i'm using latest Codeigniter and my problem is that i have this situation where i should use query inside foreach in controller. I have view that shows all production orders in one list, and i want ...
0
votes
1answer
44 views

codeigniter, Using Case When for Where Query

I have this query which i want to make it work in codeigniter query form, so want to know if its possible or not. This is the query i want to implement in Codeigniter in codeigniter's own way. ...
0
votes
2answers
32 views

Codeigniter Sql Error

function get_result_professions($key_word) { $sql = "SELECT users.name FROM users inner join users_has_professions on users_has_professions.users_id = users.id ...
2
votes
2answers
57 views

codeigniter INSERT query is correct and executed but no insert is performed

relevant code: $sql = "INSERT INTO rel_attivita_corsi(id_attivita,id_corso) VALUES"; foreach($elements as $element) { $sql .= "('".$element."','1'),"; } $sql = substr($sql,0,-1); if ...
0
votes
0answers
24 views

CodeIgniter and MongoDB : query

I'm trying to query in MongoDB using PHP/CodeIgniter but I can't find a solution... I have a first query in "function1" where there is $this->mongo_db->where("category" => ...
0
votes
1answer
56 views

Correct way to use Model's method in codeIgniter's view?

From my VIEW, let's call it 'index', on a button click I would like to perform a DATABASE QUERY without loading the page again , however I cannot think of a method to so without breaking the MVC ...
0
votes
0answers
43 views

What is the best approach handling post queries in CodeIgniter using MVC?

My view has a search box (but the question is more general than for this scenario) and when you submit your search query, controller checks your input and displays results with pagination. Now, to ...
0
votes
1answer
46 views

CodeIgniter Nested Query

I have a piece of code for getting conferences from database, where a specific subscriber is not subscribed. I have two tables: conferences - which holds all conferences read - which holds ...
0
votes
1answer
66 views

Codeigniter Active Record - WHERE inside IFNULL and COUNT

I have an application that basically simulates a locker. Inside each locker I have N racks. Inside each rack I have N boxes, N folders and N books. Some of this objects are not acessible (they have an ...
2
votes
3answers
211 views

how to get last insert id after insert query in codeigniter active record

I have an insert query for used to insert the form fileds into a mysql table. I want to get the last incremented id for the insert operation as the return of my query but I have some problems with it! ...
0
votes
2answers
59 views

Mysql Pivot View

I have a mysql table as below username interval totalmails User1 10:00 3 User2 10:00 1 User3 10:00 1 User6 10:00 4 User7 ...
1
vote
2answers
50 views

combining records from two tables in mysql ordered by date

I am having two mysql tables. One table is for "received payments" and another for "payments made". Both tables have some of the fields common but some are different like received payments have a ...
1
vote
4answers
45 views

How to get maximum no of id exist in one table?

I want to find the maximum number of ids present in a table. For example, I have a user_views table: user_views ------------------- u_v_id package_id 1 24 2 24 ...
3
votes
3answers
57 views

How to search min value from four other different fields in mysql query?

I want to search min value from four fields in mysql query, I have tried a lot of ways but didn't get it, right now I am searching only from one field, here are my fields. Table :packages ...
0
votes
2answers
41 views

Returning one cell from Codeigniter Query

I want to query a table and only need one cell returned. Right now the only way I can think to do it is: $query = $this->db->query('SELECT id FROM crops WHERE name = "wheat"'); if ...
0
votes
1answer
68 views

CodeIgniter search results are unexpected; where() with or_like() broken?

Today's date is April 25, 2013. Yes, the time on the server is correct and a var_dump of mdate('%Y-%m-%d', strtotime(now())) is returning 2013-04-25. The MySQL table column for date is the date ...
-1
votes
2answers
39 views

Codeigniter getting result from model

i have a controller called main... here i have this code. $data['companies'] = $this->companies->getAllCompanies(); $this->load->view('main_view',$data); i have loaded the model called ...
0
votes
1answer
159 views

CodeIgniter - Severity: Notice - Message: Undefined index

Trying to display results of a simple query. [EDIT] I think my query is problematic, there seems to be a conflict between activitati.denumire and proiecte.denumire, but I don't know how to work ...
0
votes
0answers
31 views

PHP Google + Profile ID query

I already have the email address of the users, how can I be able to get the userId of the user by just querying it to Google? Thanks.
0
votes
1answer
62 views

codeigniter model query not sending json data correctly

I have a codeigniter model function which queries a database and sends the result back to the controller, encoded as json. the entire function is shown below: function get_skufamily_cube($q){ ...
0
votes
1answer
50 views

2 SQL Searches off of one id in a CodeIgniter MCV enviornment

I know my problem is where I call the variables in the Controller $name and $year, I'm not sure how to format that array to a variable in the Controller. Model: function getId($id) { ...
0
votes
0answers
52 views

codeigniter query not working - response is null

I have the following function in my codeigniter Model: function get_as_09($q){ $sql=("select length from (SELECT [length] ...
0
votes
1answer
98 views

codeigniter change complex query into active record

I have a codeigniter app. My active record syntax works perfectly and is: function get_as_09($q){ $this->db->select('m3'); $this->db->where('ProductCode', $q); $query = ...
0
votes
3answers
64 views

Append variables to object with subsequent query in CodeIgniter

Say I have two tables to store user profiles: sm_user_profiles(social media), and vital_user_profiles. Now I want a universal object for accessing profile information. For the sake of clarity, this ...
1
vote
2answers
48 views

Prevent overriding queries in controller function - codeigniter

I have a searchfunction for searching factories using your postcode. this is based on a question i asked earlier today: How to search with the value of a cookie in php - codeigniter I have a query ...
0
votes
1answer
89 views

CodeIgniter Search Database based on an undefined number of fields?

long time searcher here first time asker. I am using codeigniter to create a system where a user can use a series of fields in a form to search for a result. None of the fields are required but ...
0
votes
2answers
269 views

Error : Object of class CI_DB_mysql_result could not be converted to string

I'm new to CodeIgniter, I've tried to read the documentation of CI but I still can't solve my problem, maybe someone here can help fix my problem. Here is my code: In my controller class ...
1
vote
3answers
71 views

query with date range condition returns empty result

I have a query that reads some records from a table that are in a specific date range. I am using PHP under codeigniter framework and the query is pretty simple. ...
0
votes
1answer
35 views

Active record And Joining with specific ID row

Here my problem : i have one controller called : events i have one view called : inscrits_liste i have one model called : inscrits_model I have for my query 2 tables to work on : Table 1 : ...
0
votes
1answer
38 views

How to write join select statements in code igniter

SELECT q1.user_id,q2.count,q2.total,q1.choice FROM ( SELECT "table1"."user_id" as user_id,"table2"."choice" as choice FROM "table1", "table2" WHERE ...
-2
votes
1answer
89 views

MySQL inserting new rows even after the function has stopped

Since the functions are very long, you can actually skip the function as they only extract specific data from HTML tags please try to help by providing logic to a problem on this scale I am building ...
0
votes
1answer
51 views

Delete function issues

For the past couple of days, I have been having issues deleting a simple file from a database: View: Title: Publications published: <?php echo form_open('upload/do_delete_dbdata/'); ?> ...
0
votes
1answer
104 views

MySQL - One to many query

I have one table like this: [Exam] [exam_id] [exam_name] 1 Test1 2 Test2 And other table like this: [Module] [module_id] [module_name] [exam_id] 1 Module1 1 ...
0
votes
2answers
83 views

getting last records from mysql

i have a table which store structure like this id name group_id 1 ABC 1 2 DEF 1 3 GHi 1 4 jkl 2 5 mno 2 6 pqr 2 7 stu 3 8 vwx 3 9 yz0 3 I wants to get records by there last ...
0
votes
1answer
82 views

Hierarchical query using Active Record

I have records in my db table called pages structure like: id | parent_id | title If parent_id == 0 it means that the row is a parent If parent_id != 0 it means that the row is a child I can get ...
-6
votes
1answer
73 views

mysql - most recent activities with multiple tables [closed]

I'm facing a problem with database queries atm. Assuming similar scenario like facebook. They have activities like comments, likes, posts etc. Assume I have 3 or 4 tables to populate my most recent ...
2
votes
2answers
133 views

Find online friends from ci_sessions

I am implementing a chat system in codeigniter so now i want to display online friends. Now i want to know how to find count/name of friends that are online, I have a ci_sessions table in which i am ...
1
vote
2answers
81 views

Converting MYSQL to Codeigniter

I am trying to convert a MYSQL query to codeigniter and going no wheres real fast. I am trying to convert this query $conn->prepare("SELECT `id`,`song`,`artist`,`album`,`track`,`mix_name`,`date` ...
0
votes
1answer
79 views

codeigniter / database page not loading

I have a problem whith a database request : the webpage does not load at all. public function get_mylist($user_id){ $this->db->select('*'); ...
0
votes
0answers
65 views

How do you group OR and AND statements in codeigniter with active record

$current_time = time(); $where = array( 'is_active' => 1, 'end_ts <=' => $current_time ); $two_days_ago = strtotime('-2 days', $current_time); $or_where = array( 'is_active' ...
0
votes
4answers
115 views

select-from-where query not working in codeigniter model

I am trying to select the details of the users from a table in mysql database but it is not working. This is the code in my model :- public function getuserdetails() { $user_email = ...
0
votes
2answers
94 views

SET variable on codeigniter SQL

I've tried this code: SET @num := 0, @type := NULL; SELECT categories_name, products_name, products_url, categories_id, @num := IF( @type = categories_name, @num +1, 1 ) AS row_number, ...

1 2 3 4 5
15 30 50 per page