Hi I am trying to make a simple PHP page that queries a MySQL
database.
There are two tables created by a program (I don't have any control
over the creation of these tables) but they both created by the same
data source.
I was trying to form a FULL JOIN to display data from both tables in
one web page - However I can't seem to get this to work. The only
common column in both is ResultSetID which in one is totally unique -
the other is repeated (although the identifier does relate to the same
user and data entered by that user)
The two tables are:
resultsets: (which contains the following columns)
ResultSetID, Candidate, QuizName, PercentageScore, PercentagePass,
PassFail
and
questiondata (which contains the following colloums)
ResultSetID, SectionReference, Responce
The code I have strung together so far is as follows:.....
<?php
// Make The MySQL Server + Datebase Connection
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("questions") or die(mysql_error());
// Construct our join query
$query = "SELECT * FROM questions.resultsets
FULL JOIN questions.questiondata
ON ResultSetID";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
echo $row['resultsets.ResultSetID']. " - ".
$row['questiondata.QuestionID']. " - ". $row['questiondata.Responce'];
echo "<br />";
}
?>
But the output I am getting from the webpage is:
Column 'ResultSetID' in on clause is ambiguous
Is this because the ResultSetID in the questiondata is not unique per
row? And if so is there any way to merge the two tables together?
Sorry to be a real novice but I only started to look at PHP and MySQL
last night!
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php