• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Put value to array

#1
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'");
while($row = mysql_fetch_array($result))
{
 $variabele = $row['estimated_sum'] . ",";
    echo $variabele;     
}


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?
Reply

#2
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
Reply

#3
Can somebody build the codeigniter querry from this:

Code:
$sql = "SELECT estimated_sum FROM burndown_snap WHERE project_id='$sum1' AND name='$sum2'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $burn_actual = "" . $row["estimated_sum"]. ",";
        echo $burn_actual;
}
}

Or something similar that I could list the values from the database.
Reply

#4
(12-08-2016, 04:03 AM)Fraps900 Wrote: Can somebody build the codeigniter querry from this:

Code:
$sql = "SELECT estimated_sum FROM burndown_snap WHERE project_id='$sum1' AND name='$sum2'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
   while($row = $result->fetch_assoc()) {
$burn_actual = "" . $row["estimated_sum"]. ",";
echo $burn_actual;
}
}

Or something similar that I could list the values from the database.

https://forum.codeigniter.com/thread-667...#pid339078

Wouter60 postet this link http://www.codeigniter.com/userguide3/da...index.html

read it. Dodgy
Reply

#5
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);
$this->db->where('name'$sum2); 

Then get the results
PHP Code:
$results $this->db->get('burndown_snap'); 

https://www.codeigniter.com/user_guide/d...cting-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/d...-reference
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.