// require('db.php');
mysql_connect("localhost", "root", "") or
die("Could not connect: " . mysql_error());
 mysql_select_db("alphaindia");
//SELECT Id, Name FROM coursetype where isDeleted=0
  $result = mysql_query("Call GetCourseTypes()");

  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    printf("ID: %s  Name: %s", $row["Id"], $row["Name"]);


  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
      //  printf("ID: %s  Name: %s", $row["Id"], $row["Name"]);

       echo  "<a href='UploadCourse/Step2.php?id=$row['Id']&name=$row['Name']'>$row['Id']</a>&nbsp;&nbsp;$row['Name']<br />";
   }

I am getting a blank page when i try and run the above code.

Please help i am new to php

share|improve this question
    
Check your apache error.log file – hsz Jan 31 '14 at 8:42
    
There is no issue with the error log – vini Jan 31 '14 at 8:44
    
Is that all your code ? What else do you have ? – Theox Jan 31 '14 at 8:44
    
printf("ID: %s Name: %s", $row["Id"], $row["Name"]); – vini Jan 31 '14 at 8:44
    
why two while loops?and where is the closing bracket of first while loop?also use mysqli instead of mysql – user2936213 Jan 31 '14 at 8:52
up vote 0 down vote accepted

Try this, concatenation issues in below line

 echo  "<a href='UploadCourse/Step2.php?id=".$row['Id']."&name=".$row['Name']."'>".$row['Id']."</a>&nbsp;&nbsp;".$row['Name']."<br />";

instead of

 echo  "<a href='UploadCourse/Step2.php?id=$row['Id']&name=$row['Name']'>$row['Id']</a>&nbsp;&nbsp;$row['Name']<br />";
share|improve this answer

please try.

 while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
   //  printf("ID: %s  Name: %s", $row["Id"], $row["Name"]);
   echo  "<a href='UploadCourse/Step2.php?id={$row['Id']}&name={$row['Name']}'>{$row['Id']}</a>{$row['Name']}<br />"; 
 }
share|improve this answer

Try this, without encapsulating field names with single quotes "'":

echo "<a href='UploadCourse/Step2.php?id=$row[Id]&name=$row[Name]'>$row[Id]</a>&nbsp;&nbsp;$row[Name]<br />";

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.