sql - How to get values from multiple tables in php and mysql -


hi guys have 3 tables stored data , want data them written code not work please can tell me how can that?

my first table "permission" permission names , id included here.

create table if not exists `permission` ( `permission_id` int(11) not null, `permission_description` varchar(50) not null ) engine=innodb auto_increment=25 default charset=latin1; 

second table "role" included role names roles id.

create table if not exists `role` ( `id` int(11) not null, `role_group` int(11) not null, `role_name` varchar(50) not null, `role_description` varchar(50) not null ) engine=innodb auto_increment=29 default charset=latin1; 

and third "role_permission" included permissions in "permission" table can access role in "role" table.

create table if not exists `role_permission` ( `id` int(11) not null, `role_id` int(11) not null, `permission_id` int(11) not null ) engine=innodb default charset=latin1; 

php:

$result3 = $dp->sql_query("select p.*, r.*, a.* role_permission p, role r, permission p.role_id = r.id , p.permission_id = a.permission_id");     $rules = array(); while($rows3 = $dp->sql_fetchrow($result3))         {             $rules[] = array("title" => $rows3['permission_description'], // value "permission" table                             "pages" => $row3['role_name'] . ", ",         // value "role" table                             "pdes" => $row3['role_description']           // value "role" table                      );         }  $smarty->assign("rules", $rules); 

html:

<div class="modal-body">             {foreach $rules $rule}                 <blockquote>                     <p>                         <strong>{$rule.title}:</strong>                         <br>                         <small>{$rule.pages}</small>                     </p>                 </blockquote>             {/foreach}             </div> 

apparently same column id in table role , role_permission. array $rows3 contain erroneous same attribute id. v.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -