i created a database (Questionnaires)
i also create two tables (Questions and Answers)


i successfully display the questions randomly but my problem is i cannot connect the answers according to its primary ID

here is my code

mysql_select_db("questionaires", $con);
$result = mysql_query("Select * from Answers where AnswerID = {$row['QuestionID']} order by AnswerID asc");
while($row = mysql_fetch_array($result))
{
	echo $row['Answers'];
	echo "<br/>";
}

i dont know if the syntax is correct..

Recommended Answers

All 3 Replies

Where is the select query for question table?
Post that query and also any error is you getting.

why use 2 tabels?
isn't it easier to use only one?

Member Avatar for diafol

> i dont know if the syntax is correct..

SO?
What do you want? SOmebody to check your code for you?

What's the problem? DO you get an error? More info.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.