PHP Oracle query set the data on the right column position
I have data on table like this
and PHP Code below
<table id="datatable" border="1">
<thead>
<tr>
<th></th>
<?php
$rpID = array();
require("../config/db.php");
$qRejectProcess = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY),
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qRejectProcess);
while($dRejectProcess = oci_fetch_array($qRejectProcess))
{
$rpID = $dRejectProcess['RPID_FK'];
?>
<th><?php echo $dRejectProcess['RP_NAME']; ?></th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$qModel = oci_parse($c1, "SELECT * FROM WA_LFO_TBL_MODEL WHERE ACTIVE = 'Y' ORDER BY MODEL_NAME ASC");
oci_execute($qModel);
while($dModel = oci_fetch_array($qModel))
{
?>
<tr>
<th><?php echo $dModel['MODEL_NAME']; ?></th>
<?php
$qOutputReject = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY) AS TOTAL_QUANTITY,
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK AND
O.MODELID_FK = '" . $dModel['MODELID'] . "'
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qOutputReject);
while($dOutputReject = oci_fetch_array($qOutputReject))
{
?>
<td><?php echo $dOutputReject['TOTAL_QUANTITY']; ?></td>
<?php
}
?>
</tr>
<?php
}
?>
On that table, you can see CitySiren
there that the quantity 46
should be belongs to Piezo sound level
and 1
for Battery level
. In this case Battery level
is not on top 10 as per my query. So the quantity should not be there.
What I expect is
My question: how to set the quantity based on model on the correct process (on this case City Siren
with quantity 46
should be on Piezo sound level
process)?
php oracle
add a comment |
I have data on table like this
and PHP Code below
<table id="datatable" border="1">
<thead>
<tr>
<th></th>
<?php
$rpID = array();
require("../config/db.php");
$qRejectProcess = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY),
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qRejectProcess);
while($dRejectProcess = oci_fetch_array($qRejectProcess))
{
$rpID = $dRejectProcess['RPID_FK'];
?>
<th><?php echo $dRejectProcess['RP_NAME']; ?></th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$qModel = oci_parse($c1, "SELECT * FROM WA_LFO_TBL_MODEL WHERE ACTIVE = 'Y' ORDER BY MODEL_NAME ASC");
oci_execute($qModel);
while($dModel = oci_fetch_array($qModel))
{
?>
<tr>
<th><?php echo $dModel['MODEL_NAME']; ?></th>
<?php
$qOutputReject = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY) AS TOTAL_QUANTITY,
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK AND
O.MODELID_FK = '" . $dModel['MODELID'] . "'
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qOutputReject);
while($dOutputReject = oci_fetch_array($qOutputReject))
{
?>
<td><?php echo $dOutputReject['TOTAL_QUANTITY']; ?></td>
<?php
}
?>
</tr>
<?php
}
?>
On that table, you can see CitySiren
there that the quantity 46
should be belongs to Piezo sound level
and 1
for Battery level
. In this case Battery level
is not on top 10 as per my query. So the quantity should not be there.
What I expect is
My question: how to set the quantity based on model on the correct process (on this case City Siren
with quantity 46
should be on Piezo sound level
process)?
php oracle
add a comment |
I have data on table like this
and PHP Code below
<table id="datatable" border="1">
<thead>
<tr>
<th></th>
<?php
$rpID = array();
require("../config/db.php");
$qRejectProcess = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY),
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qRejectProcess);
while($dRejectProcess = oci_fetch_array($qRejectProcess))
{
$rpID = $dRejectProcess['RPID_FK'];
?>
<th><?php echo $dRejectProcess['RP_NAME']; ?></th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$qModel = oci_parse($c1, "SELECT * FROM WA_LFO_TBL_MODEL WHERE ACTIVE = 'Y' ORDER BY MODEL_NAME ASC");
oci_execute($qModel);
while($dModel = oci_fetch_array($qModel))
{
?>
<tr>
<th><?php echo $dModel['MODEL_NAME']; ?></th>
<?php
$qOutputReject = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY) AS TOTAL_QUANTITY,
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK AND
O.MODELID_FK = '" . $dModel['MODELID'] . "'
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qOutputReject);
while($dOutputReject = oci_fetch_array($qOutputReject))
{
?>
<td><?php echo $dOutputReject['TOTAL_QUANTITY']; ?></td>
<?php
}
?>
</tr>
<?php
}
?>
On that table, you can see CitySiren
there that the quantity 46
should be belongs to Piezo sound level
and 1
for Battery level
. In this case Battery level
is not on top 10 as per my query. So the quantity should not be there.
What I expect is
My question: how to set the quantity based on model on the correct process (on this case City Siren
with quantity 46
should be on Piezo sound level
process)?
php oracle
I have data on table like this
and PHP Code below
<table id="datatable" border="1">
<thead>
<tr>
<th></th>
<?php
$rpID = array();
require("../config/db.php");
$qRejectProcess = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY),
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qRejectProcess);
while($dRejectProcess = oci_fetch_array($qRejectProcess))
{
$rpID = $dRejectProcess['RPID_FK'];
?>
<th><?php echo $dRejectProcess['RP_NAME']; ?></th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$qModel = oci_parse($c1, "SELECT * FROM WA_LFO_TBL_MODEL WHERE ACTIVE = 'Y' ORDER BY MODEL_NAME ASC");
oci_execute($qModel);
while($dModel = oci_fetch_array($qModel))
{
?>
<tr>
<th><?php echo $dModel['MODEL_NAME']; ?></th>
<?php
$qOutputReject = oci_parse($c1, "
SELECT * FROM(
SELECT
SUM(O.QUANTITY) AS TOTAL_QUANTITY,
P.RP_NAME,
O.RPID_FK
FROM
WA_LFO_TBL_REJECT_PROCESS P,
WA_LFO_TBL_REJECT_OUTPUT O
WHERE
P.RP_ID = O.RPID_FK AND
O.MODELID_FK = '" . $dModel['MODELID'] . "'
GROUP BY
P.RP_NAME,
O.RPID_FK
ORDER BY
SUM(O.QUANTITY) DESC)
WHERE
ROWNUM <= 10
");
oci_execute($qOutputReject);
while($dOutputReject = oci_fetch_array($qOutputReject))
{
?>
<td><?php echo $dOutputReject['TOTAL_QUANTITY']; ?></td>
<?php
}
?>
</tr>
<?php
}
?>
On that table, you can see CitySiren
there that the quantity 46
should be belongs to Piezo sound level
and 1
for Battery level
. In this case Battery level
is not on top 10 as per my query. So the quantity should not be there.
What I expect is
My question: how to set the quantity based on model on the correct process (on this case City Siren
with quantity 46
should be on Piezo sound level
process)?
php oracle
php oracle
asked Nov 14 '18 at 8:26
HiDayurie DaveHiDayurie Dave
7171723
7171723
add a comment |
add a comment |
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%2f53295814%2fphp-oracle-query-set-the-data-on-the-right-column-position%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%2f53295814%2fphp-oracle-query-set-the-data-on-the-right-column-position%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