$sqlOptions="SELECT options.optionid,options.optiontext,options.optionvalue FROM options,questions WHERE options.questionid="$row[questionid];
Whts the correct way to do it?
Here is the code:
<?php //Prepare SQL Statement queryset $sqlQuestion="SELECT questionid, questiontext FROM questions"; $resultQuestion = mysql_query($sqlQuestion); // Write out the HTML for the page ?> <html> <body> <form method="POST" action="process.php"> <!-- Write out the question Text --> <table border="1" cellpadding="6"> <?php while($row = mysql_fetch_array($resultQuestion )) { echo "<tr>"; echo "<td width=525>" . $row['questiontext'] . "</td>"; echo "Hello"; //<---code works fine upto here //Prepare statement to fetch options for each question as a queryset //----->The error is here<----- $sqlOptions="SELECT options.optionid,options.optiontext,options.optionvalue FROM options,questions WHERE options.questionid=".$row['questionid']. ; $resultOption = mysql_query($sqlOptions); /*while($col = mysql_fetch_array($resultOption)) { if($row['questionid']==1)In SQL-T I hv used " ' " varname " ' " to use it within the SQL, in some +varname+,(but this is string concatenation).
Please enlighten me.