Welcome Guest, Not a member yet? Register   Sign In
SQL Join Tables
#11

[eluser]RedIgniter[/eluser]
[quote author="Mischievous" date="1286328580"]
Code:
$query = "SELECT A.firstname, A.lastname, A.email,
       S.subject, S.sub_subject, S.experience,
       DA.monday, DA.tuesday, DA.wednesday
FROM accounts as A
LEFT JOIN subjects as S ON A.id = S.tid
LEFT JOIN days_attending as DA ON A.id = DA.tid";

if($result = $this->db->query($query))
{
   $list = array();
   foreach($result->result() as $row){
      $list[] = $row;
   }

   //For testing, showing your results
   echo "<pre>";
   print_r($list);
   echo "</pre>";
   //End Testings

} else {
echo "problem with query:" . $query;
}

Something like that should work?[/quote]

Thanks, really helped!
#12

[eluser]chazy (aldever calvo)[/eluser]
[quote author="Mischievous" date="1286328580"]
Code:
$query = "SELECT A.firstname, A.lastname, A.email,
       S.subject, S.sub_subject, S.experience,
       DA.monday, DA.tuesday, DA.wednesday
FROM accounts as A
LEFT JOIN subjects as S ON A.id = S.tid
LEFT JOIN days_attending as DA ON A.id = DA.tid";

if($result = $this->db->query($query))
{
   $list = array();
   foreach($result->result() as $row){
      $list[] = $row;
   }

   //For testing, showing your results
   echo "<pre>";
   print_r($list);
   echo "</pre>";
   //End Testings

} else {
echo "problem with query:" . $query;
}

Something like that should work?[/quote]

thanks this helps.. Smile




Theme © iAndrew 2016 - Forum software by © MyBB