Jump to content

Any idea why this code doesn't work?


Bentley4

Recommended Posts

Hi guys,

When I insert the following code I get the parsing error "unexpected $end":

<?PHP  
if(isSet($_GET['sid'])) {
   $con = mysql_connect("localhost","YYYYY", "XXXXX");
   if (!$con) {die('Could not connect: ' . mysql_error("oop"));
   mysql_select_db("YYYYY_testDB") or die(mysql_error());
   $totalresult = mysql_query("SELECT * FROM QANDATable");
   $num_rows = mysql_num_rows($totalresult);
   $limit;
   $counter = 1;
   while($counter < mysql_num_rows($totalresult)){
      $result = mysql_query("SELECT * FROM QANDATable WHERE id = $counter");
      $row = mysql_fetch_array($result);
      echo $row['TSuperQuestion'];
      if(isSet($_GET['sid'])){
      echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";}
      echo $row['TQuestion'];
      echo $row['TAnswer'];       
      $counter++;}   
   } 
else {
   echo "<h2>Enter Student Number:</h2>";
   echo '<form name="input" action="./Code-sandbox.php" method="GET">';
   echo '<input type="text" name="sid"/>';
   echo '<input type="submit" value="Submit">';
   echo '</form>';    
   }
?>

 

The code worked before I inserted:

if(isSet($_GET['sid'])){
echo "<a href=\"/Code-sandbox.php?sid=".$name."&qandanumber=".$counter."\">next</a>";}

Any idea what is wrong here?

Link to comment
https://forums.phpfreaks.com/topic/237520-any-idea-why-this-code-doesnt-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.