Jump to content

Duplicated results in query


mjs87

Recommended Posts

Hi I am trying to select the document titles stored in a database. However I only want to select the title for a document that belongs to the user that is logged in, furthermore the user (teacher) teaches a maximum of 2 subject I therefore am only selecting documents that belong to subject 1. The problem I am having is that the results are displayed twice.

 

Here are my tables:

 

tblPlan

docname

doctitle

subject

uname

datecreated

datemodified

modifiedby

 

 

tblSubjectUser

uname

subject

subjectnum

 

The Select statement:

 

$uname = $_SESSION['uname'];

$sSQLDoc="SELECT tblPlan.docname, tblPlan.doctitle, tblPlan.datecreated, tblPlan.datemodified, tblPlan.modifiedby
FROM tblPlan INNER JOIN tblSubjectUser ON tblPlan.subject = tblSubjectUser.subject
WHERE (((tblPlan.uname)='$uname') AND ((tblSubjectUser.subjectnum)='1'))";
$rsDoc = mysql_query($sSQLDoc);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.