Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

help newbie with query

$
0
0
It's a couple of weeks that I'm playing with CodeIgniter in my spare time, I like it, but I'm totally newbie so please .... be patient !

In my DB I have 2 tables 'authors' and 'songs'

CREATE TABLE `authors`(`Anome` varchar(160) ...

CREATE TABLE `songs` (`Bnome` varchar(160) ,
                         `Bautore` varchar(160) ....

in "views/myappl/index.php" I list all the authors
<a href="<?php echo site_url('myapp/indexAutore'); ?>">lista indexAutore</a>

"views/myappl/indexAutore.php" contains
foreach ($authors as $authors_item):
   $autore=$authors_item['Anome'];
   echo "<p><a href=". site_url('myapp/braniXautore/'.rawurlencode($autore));
   echo ">view detail</a></p>";
endforeach;

when the user click on an author (href) I would like to list all his songs (all the songs of 'Anome' in authors <=> Bautore in songs)

in "views/myappl/braniXautore.php" there is
foreach ($songs as $songs_item):
   $brano=$songs_item['Bnome'];
   echo $brano;
endforeach;

Unfortunately 'Bnome' appears as null, so all the songs of all the authors are listed
:-(
What am I missing ?
What am I doing worng ?

THANKS for your PATIENCE !!!

the model contais:
------------------------------------------------------------------------------------------
   public function get_authorsBrani($Bnome = FALSE)  {
      if ($Bnome === FALSE) {
         $query = $this->db->get('songs');
         return $query->result_array();
      }
      $Bnome=urldecode($Bnome);
      $query = $this->db->get_where('songs', array('Bnome' => $Bnome));
      return $query->row_array();
   }
------------------------------------------------------------------------------------------

in routes there is:
------------------------------------------------------------------------------------------
$route['myappl/indexAutore'] = 'songs/indexAutore';
$route['myappl/braniXautore'] = 'songs/braniXautore/$1';
$route['myappl/braniXautore/(:any)'] = 'songs/braniXautore/$1';
$route['myappl/(:any)'] = 'songs/braniXutore/$1';
$route['myappl'] = 'songs';
------------------------------------------------------------------------------------------

Viewing all articles
Browse latest Browse all 14114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>