![]() |
Put value to array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Put value to array (/showthread.php?tid=66822) |
Put value to array - Fraps900 - 12-07-2016 Hi guys, I'm stuck on this: Is there any possible to get the value from here: Code: $result = mysql_query("SELECT estimated_sum FROM burndown_snap WHERE project_id ='$sum1' AND name='$sum2'"); And put the values here: Code: $actualArray = array(? , ? , ?); It's not so simple as I thought. Cannot just put there $variabele it's dosent work. Any suggestions? RE: Put value to array - Paradinight - 12-07-2016 Wrong board if you use mysql_query... if you use codeigniter and mysql_query you do not read the manual from codeigniter. $variabele['b'] = $row['estimated_sum'] . ","; echo $variabele['b']; \b never see it RE: Put value to array - Fraps900 - 12-08-2016 Can somebody build the codeigniter querry from this: Code: $sql = "SELECT estimated_sum FROM burndown_snap WHERE project_id='$sum1' AND name='$sum2'"; Or something similar that I could list the values from the database. RE: Put value to array - Paradinight - 12-08-2016 (12-08-2016, 03:03 AM)Fraps900 Wrote: Can somebody build the codeigniter querry from this: https://forum.codeigniter.com/thread-66788-post-339078.html#pid339078 Wouter60 postet this link http://www.codeigniter.com/userguide3/da...index.html read it. ![]() RE: Put value to array - PaulD - 12-08-2016 It is very easy. First select what you want PHP Code: $this->db->select('estimated_sum'); Then add some conditions PHP Code: $this->db->where('project_id', $sum1); Then get the results PHP Code: $results = $this->db->get('burndown_snap'); https://www.codeigniter.com/user_guide/database/query_builder.html#selecting-data I would strongly suggest that the docs (which are extensive, clearly written and extremely detailed with great examples) is well worth a read from top to bottom. You can start at the beginning or skip to here: https://www.codeigniter.com/user_guide/database/index.html#database-reference |