please don't hijack a thread, if its a new question start a new thread
if its a PHP problem ask it in the PHP forum
I thought MySQL used the " to delimit strings
you are also missing and AND int he where clause
and you are also missing the terminating semicolon
Code:
$query_Recordset1 = "SELECT topics.topic, topics.name FROM topics WHERE excode=\"$exam\ AND" cocode=\"$cur\" AND tpcode=\"$tps\";" ;
Whenever you have problems with SQL, especially if you are building the SQL using parameters or variables from elsewhere it generally pays to display the sql somewhere so you can make sure what you are sending to the SQL engine is actually what you think it is. It also helps if you assing the SQL to a variable (say $strSQL).
you could do this using the or die construct
or die(echo " The SQL is:".$strSQL; )
some people prefer to separate the lines so its easier to read
Code:
$query_Recordset1 = "SELECT topics.topic, topics.name FROM topics
WHERE excode="$exam"
AND cocode="$cur'
AND tpcode="$tps";";