<?php
// **************** Results are shown according to the keywords selected *******************
if ($HTTP_POST_VARS['select_paper1']=='Keywords')
{
require("the_jewel.php");
$uniquetitles = array();
if ($HTTP_POST_VARS['results'] =='differences')
{
$j=0;
$sql = "SELECT paper_exp_mod_con_id
FROM schmitzs.paper_exp_mod_poe_con
WHERE paper_exp_mod_poe_con_id in (SELECT paper_exp_mod_poe_con_id
FROM schmitzs.statistics
WHERE sign_level <> 'n.s.'
GROUP BY paper_exp_mod_poe_con_id)
GROUP BY paper_exp_mod_con_id";
$stmt = OCIParse($conn, $sql);
OCIExecute($stmt);
while ($temp = OCIFetch($stmt)) //reads row by row
{
$paper_exp_mod_con_id = OCIResult($stmt, "PAPER_EXP_MOD_CON_ID");
$sql2 = "SELECT m_rid
FROM schmitzs.paper_exp_mod_con
WHERE paper_exp_mod_con_id = ".$paper_exp_mod_con_id."
GROUP BY m_rid";
$stmt2 = OCIParse($conn, $sql2);
OCIExecute($stmt2);
while ($temp = OCIFetch($stmt2)) //reads row by row
{
$m_rid = OCIResult($stmt2, "M_RID");
$sql3 = "SELECT p_title
FROM schmitzs.paper_details
WHERE m_rid = '$m_rid'
GROUP BY p_title";
$stmt3 = OCIParse($conn, $sql3);
OCIExecute($stmt3);
while ($temp = OCIFetch($stmt3)) //reads row by row
{
$p_title = OCIResult($stmt3, "P_TITLE");
echo "$p_title";
echo"<br>";
}
}
}
}
}
?>
This is the program code I have wriiten.
the problem of the database structure here is:-
only the records with paper_exp_mod_con_id from paper_exp_mod_poe_con table with the paper_exp_mod_poe_con_ids coming from statistics table which has sign_level not equal to 'n.s.' should be returned and the result here is
SQL:-
SELECT paper_exp_mod_con_id FROM schmitzs.paper_exp_mod_poe_con
WHERE paper_exp_mod_poe_con_id in (SELECT paper_exp_mod_poe_con_id FROM schmitzs.statistics WHERE sign_level <> 'n.s.' GROUP BY paper_exp_mod_poe_con_id) GROUP BY paper_exp_mod_con_id";
RESULT:-
PAPER_EXP_MOD_CON_ID
1
3
4
5
6
7
then this id is passed to the paper_exp_mod_con table to get the m_rid one by one and the result obtained here is:-
SQL:-
SELECT m_rid FROM schmitzs.paper_exp_mod_con WHERE paper_exp_mod_con_id = ".$paper_exp_mod_con_id."";
RESULT:-
PAPER_EXP_MOD_CON_ID M-RID
1 3
3 4
4 20
5 25
6 25
7 26
so the problem here is m_rid with 25 is returned twice but only once I need it.
SQL:-
select paper_title from paper_details where m_rid in (3,4,20,25,25,26);
Result:-
Sex differences in the functional organization of the brain for language
Language processing is strongly left lateralized in both sexes. Evidence from functional MRI
Sex differences in lateralization revealed in the posterior language areas
Sex differences in semantic language processing: A functional MRI Study
Sex differences in semantic language processing: A functional MRI Study
Temporal lobe activation demonstrates sex based differences during passive listening
here the red coloured results should appear only once. But it appears twice. Can anyone help me in this regard so that I get only one time and not repeated results.
Thanks
Ramya