Concep of c# Dictionary in PHP Codeigniter Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to merge two dictionaries in a single expression?How can I prevent SQL injection in PHP?How do I sort a list of dictionaries by a value of the dictionary?What is the best way to iterate over a dictionary?PHP: Delete an element from an arrayHow do I sort a dictionary by value?Add new keys to a dictionary?Check if a given key already exists in a dictionaryIterating over dictionaries using 'for' loopsReference — What does this symbol mean in PHP?
NERDTreeMenu Remapping
How can a team of shapeshifters communicate?
Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?
Why is std::move not [[nodiscard]] in C++20?
Why is it faster to reheat something than it is to cook it?
Relating to the President and obstruction, were Mueller's conclusions preordained?
Did any compiler fully use 80-bit floating point?
How to ask rejected full-time candidates to apply to teach individual courses?
How many time has Arya actually used Needle?
Test print coming out spongy
Google .dev domain strangely redirects to https
Can an iPhone 7 be made to function as a NFC Tag?
Co-worker has annoying ringtone
Why complex landing gears are used instead of simple,reliability and light weight muscle wire or shape memory alloys?
Does the Mueller report show a conspiracy between Russia and the Trump Campaign?
A `coordinate` command ignored
White walkers, cemeteries and wights
In musical terms, what properties are varied by the human voice to produce different words / syllables?
A proverb that is used to imply that you have unexpectedly faced a big problem
If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?
How to force a browser when connecting to a specific domain to be https only using only the client machine?
Does the Black Tentacles spell do damage twice at the start of turn to an already restrained creature?
How do living politicians protect their readily obtainable signatures from misuse?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Concep of c# Dictionary in PHP Codeigniter
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to merge two dictionaries in a single expression?How can I prevent SQL injection in PHP?How do I sort a list of dictionaries by a value of the dictionary?What is the best way to iterate over a dictionary?PHP: Delete an element from an arrayHow do I sort a dictionary by value?Add new keys to a dictionary?Check if a given key already exists in a dictionaryIterating over dictionaries using 'for' loopsReference — What does this symbol mean in PHP?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to implement the concept of dictionary which i use in c# in order to collect multiple records based on multiple id's. But i hardly find any such thing in codeigniter framework. What I have is a Course table and another table naming course_prices. Now each course has multiple prices. And I'm trying to display using bootstrap according having course name as title of header accordion and list of prices on the content div.
As i couldn't find the concept of dictionary here, i tried with writing join query but that wouldn't help. The details of courses are repeated.
Below is my code
$this->load->model('Courses_model', 'Courses');
$model = $this->Courses;
$records = $model->setAlias('c')
->find()
->select('c.*,cp.Id as PriceId')
->join('course_price AS cp', 'c.id = cp.CourseId')
->get()
->result_array();
And this is the view
<?php if(empty($courses)) print_r("no class available"); else{ print_r($courses); foreach ($courses as $k => $course) ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading<?=$k?>">
<h4 class="panel-title">
<a class="" role="button" data-toggle="collapse" data-parent="#accordion9" href="#collapse<?=$k?>" aria-expanded="true" aria-controls="collapseOne9">
<?= $course->name ?>
</a>
</h4>
</div>
<div id="collapse<?=$k?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?=$k?>">
<div class="panel-body">
<?php foreach ($course->course_price as $key => $price) ?>
<div class="custom-controls-stacked">
<div class="custom-control custom-radio">
<input name="class" id="class_1<?= $k ?>" type="radio" class="custom-control-input" value="<?= $price->PriceId; ?>" required>
<label for="class_<?= $k ?>" class="custom-control-label">Drop In Price <?= $course->price ?></label>
</div>
</div>
</div>
</div>
</div>
<?php ?>
php codeigniter dictionary
|
show 6 more comments
I'm trying to implement the concept of dictionary which i use in c# in order to collect multiple records based on multiple id's. But i hardly find any such thing in codeigniter framework. What I have is a Course table and another table naming course_prices. Now each course has multiple prices. And I'm trying to display using bootstrap according having course name as title of header accordion and list of prices on the content div.
As i couldn't find the concept of dictionary here, i tried with writing join query but that wouldn't help. The details of courses are repeated.
Below is my code
$this->load->model('Courses_model', 'Courses');
$model = $this->Courses;
$records = $model->setAlias('c')
->find()
->select('c.*,cp.Id as PriceId')
->join('course_price AS cp', 'c.id = cp.CourseId')
->get()
->result_array();
And this is the view
<?php if(empty($courses)) print_r("no class available"); else{ print_r($courses); foreach ($courses as $k => $course) ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading<?=$k?>">
<h4 class="panel-title">
<a class="" role="button" data-toggle="collapse" data-parent="#accordion9" href="#collapse<?=$k?>" aria-expanded="true" aria-controls="collapseOne9">
<?= $course->name ?>
</a>
</h4>
</div>
<div id="collapse<?=$k?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?=$k?>">
<div class="panel-body">
<?php foreach ($course->course_price as $key => $price) ?>
<div class="custom-controls-stacked">
<div class="custom-control custom-radio">
<input name="class" id="class_1<?= $k ?>" type="radio" class="custom-control-input" value="<?= $price->PriceId; ?>" required>
<label for="class_<?= $k ?>" class="custom-control-label">Drop In Price <?= $course->price ?></label>
</div>
</div>
</div>
</div>
</div>
<?php ?>
php codeigniter dictionary
The C#'s concept for Dictionnary is similar to what's named a Map in other languages, isn't it? If so, you could use the PHP's array. The array is a mix between array, vector and map.
– AnthonyB
Mar 22 at 11:25
We (PHP people) just call them arrays with string keys, lol. or Associative arrays.
– ArtisticPhoenix
Mar 22 at 11:26
So PHP coders, how do i apply the above scenario using Associative arrays or array mapping?
– Salar Muhammad
Mar 22 at 11:28
<?= $course->name ?>
might want some semi-colons there.... And these ID's will probably be duplicateid="class_1<?= $k ?>"
$k
is the key of the outer loop the one over$courses
that I almost didn't see. So when you loop with the inner loop$k
doesn't change.
– ArtisticPhoenix
Mar 22 at 11:29
@ArtisticPhoenix Good eye :)
– Salar Muhammad
Mar 22 at 11:31
|
show 6 more comments
I'm trying to implement the concept of dictionary which i use in c# in order to collect multiple records based on multiple id's. But i hardly find any such thing in codeigniter framework. What I have is a Course table and another table naming course_prices. Now each course has multiple prices. And I'm trying to display using bootstrap according having course name as title of header accordion and list of prices on the content div.
As i couldn't find the concept of dictionary here, i tried with writing join query but that wouldn't help. The details of courses are repeated.
Below is my code
$this->load->model('Courses_model', 'Courses');
$model = $this->Courses;
$records = $model->setAlias('c')
->find()
->select('c.*,cp.Id as PriceId')
->join('course_price AS cp', 'c.id = cp.CourseId')
->get()
->result_array();
And this is the view
<?php if(empty($courses)) print_r("no class available"); else{ print_r($courses); foreach ($courses as $k => $course) ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading<?=$k?>">
<h4 class="panel-title">
<a class="" role="button" data-toggle="collapse" data-parent="#accordion9" href="#collapse<?=$k?>" aria-expanded="true" aria-controls="collapseOne9">
<?= $course->name ?>
</a>
</h4>
</div>
<div id="collapse<?=$k?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?=$k?>">
<div class="panel-body">
<?php foreach ($course->course_price as $key => $price) ?>
<div class="custom-controls-stacked">
<div class="custom-control custom-radio">
<input name="class" id="class_1<?= $k ?>" type="radio" class="custom-control-input" value="<?= $price->PriceId; ?>" required>
<label for="class_<?= $k ?>" class="custom-control-label">Drop In Price <?= $course->price ?></label>
</div>
</div>
</div>
</div>
</div>
<?php ?>
php codeigniter dictionary
I'm trying to implement the concept of dictionary which i use in c# in order to collect multiple records based on multiple id's. But i hardly find any such thing in codeigniter framework. What I have is a Course table and another table naming course_prices. Now each course has multiple prices. And I'm trying to display using bootstrap according having course name as title of header accordion and list of prices on the content div.
As i couldn't find the concept of dictionary here, i tried with writing join query but that wouldn't help. The details of courses are repeated.
Below is my code
$this->load->model('Courses_model', 'Courses');
$model = $this->Courses;
$records = $model->setAlias('c')
->find()
->select('c.*,cp.Id as PriceId')
->join('course_price AS cp', 'c.id = cp.CourseId')
->get()
->result_array();
And this is the view
<?php if(empty($courses)) print_r("no class available"); else{ print_r($courses); foreach ($courses as $k => $course) ?>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading<?=$k?>">
<h4 class="panel-title">
<a class="" role="button" data-toggle="collapse" data-parent="#accordion9" href="#collapse<?=$k?>" aria-expanded="true" aria-controls="collapseOne9">
<?= $course->name ?>
</a>
</h4>
</div>
<div id="collapse<?=$k?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading<?=$k?>">
<div class="panel-body">
<?php foreach ($course->course_price as $key => $price) ?>
<div class="custom-controls-stacked">
<div class="custom-control custom-radio">
<input name="class" id="class_1<?= $k ?>" type="radio" class="custom-control-input" value="<?= $price->PriceId; ?>" required>
<label for="class_<?= $k ?>" class="custom-control-label">Drop In Price <?= $course->price ?></label>
</div>
</div>
</div>
</div>
</div>
<?php ?>
php codeigniter dictionary
php codeigniter dictionary
edited Mar 22 at 11:53
Salar Muhammad
asked Mar 22 at 11:17
Salar MuhammadSalar Muhammad
85211
85211
The C#'s concept for Dictionnary is similar to what's named a Map in other languages, isn't it? If so, you could use the PHP's array. The array is a mix between array, vector and map.
– AnthonyB
Mar 22 at 11:25
We (PHP people) just call them arrays with string keys, lol. or Associative arrays.
– ArtisticPhoenix
Mar 22 at 11:26
So PHP coders, how do i apply the above scenario using Associative arrays or array mapping?
– Salar Muhammad
Mar 22 at 11:28
<?= $course->name ?>
might want some semi-colons there.... And these ID's will probably be duplicateid="class_1<?= $k ?>"
$k
is the key of the outer loop the one over$courses
that I almost didn't see. So when you loop with the inner loop$k
doesn't change.
– ArtisticPhoenix
Mar 22 at 11:29
@ArtisticPhoenix Good eye :)
– Salar Muhammad
Mar 22 at 11:31
|
show 6 more comments
The C#'s concept for Dictionnary is similar to what's named a Map in other languages, isn't it? If so, you could use the PHP's array. The array is a mix between array, vector and map.
– AnthonyB
Mar 22 at 11:25
We (PHP people) just call them arrays with string keys, lol. or Associative arrays.
– ArtisticPhoenix
Mar 22 at 11:26
So PHP coders, how do i apply the above scenario using Associative arrays or array mapping?
– Salar Muhammad
Mar 22 at 11:28
<?= $course->name ?>
might want some semi-colons there.... And these ID's will probably be duplicateid="class_1<?= $k ?>"
$k
is the key of the outer loop the one over$courses
that I almost didn't see. So when you loop with the inner loop$k
doesn't change.
– ArtisticPhoenix
Mar 22 at 11:29
@ArtisticPhoenix Good eye :)
– Salar Muhammad
Mar 22 at 11:31
The C#'s concept for Dictionnary is similar to what's named a Map in other languages, isn't it? If so, you could use the PHP's array. The array is a mix between array, vector and map.
– AnthonyB
Mar 22 at 11:25
The C#'s concept for Dictionnary is similar to what's named a Map in other languages, isn't it? If so, you could use the PHP's array. The array is a mix between array, vector and map.
– AnthonyB
Mar 22 at 11:25
We (PHP people) just call them arrays with string keys, lol. or Associative arrays.
– ArtisticPhoenix
Mar 22 at 11:26
We (PHP people) just call them arrays with string keys, lol. or Associative arrays.
– ArtisticPhoenix
Mar 22 at 11:26
So PHP coders, how do i apply the above scenario using Associative arrays or array mapping?
– Salar Muhammad
Mar 22 at 11:28
So PHP coders, how do i apply the above scenario using Associative arrays or array mapping?
– Salar Muhammad
Mar 22 at 11:28
<?= $course->name ?>
might want some semi-colons there.... And these ID's will probably be duplicate id="class_1<?= $k ?>"
$k
is the key of the outer loop the one over $courses
that I almost didn't see. So when you loop with the inner loop $k
doesn't change.– ArtisticPhoenix
Mar 22 at 11:29
<?= $course->name ?>
might want some semi-colons there.... And these ID's will probably be duplicate id="class_1<?= $k ?>"
$k
is the key of the outer loop the one over $courses
that I almost didn't see. So when you loop with the inner loop $k
doesn't change.– ArtisticPhoenix
Mar 22 at 11:29
@ArtisticPhoenix Good eye :)
– Salar Muhammad
Mar 22 at 11:31
@ArtisticPhoenix Good eye :)
– Salar Muhammad
Mar 22 at 11:31
|
show 6 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55298477%2fconcep-of-c-sharp-dictionary-in-php-codeigniter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55298477%2fconcep-of-c-sharp-dictionary-in-php-codeigniter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The C#'s concept for Dictionnary is similar to what's named a Map in other languages, isn't it? If so, you could use the PHP's array. The array is a mix between array, vector and map.
– AnthonyB
Mar 22 at 11:25
We (PHP people) just call them arrays with string keys, lol. or Associative arrays.
– ArtisticPhoenix
Mar 22 at 11:26
So PHP coders, how do i apply the above scenario using Associative arrays or array mapping?
– Salar Muhammad
Mar 22 at 11:28
<?= $course->name ?>
might want some semi-colons there.... And these ID's will probably be duplicateid="class_1<?= $k ?>"
$k
is the key of the outer loop the one over$courses
that I almost didn't see. So when you loop with the inner loop$k
doesn't change.– ArtisticPhoenix
Mar 22 at 11:29
@ArtisticPhoenix Good eye :)
– Salar Muhammad
Mar 22 at 11:31