943,735 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1601
  • PHP RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Jun 10th, 2009
0

Re: make link from a variable.

you can print the $lessonID after the Datails word...

I don't like saying this but my version still created the same output like navi17's example,

decide which is shorten or which comes earier

php Syntax (Toggle Plain Text)
  1. echo "<tr>
  2. <td><a href='details.php?lessonID=$lessonID'>Details for $subject( $lessonID )</a></td>
  3. <td>$subject</td>
  4. <td>$learningArea</td>
  5. <td>$noofstudents</td>
  6. <td>$minutes</td>
  7. <td>$class</td>
  8. <td> $ability</td>
  9. </tr>" ;
Reputation Points: 12
Solved Threads: 11
Junior Poster in Training
djjjozsi is offline Offline
69 posts
since Jun 2009
Jun 11th, 2009
0

Re: make link from a variable.

PHP Syntax (Toggle Plain Text)
  1. <?php
  2.  
  3. mysql_connect("localhost","root","");
  4.  
  5. mysql_select_db("student") or die("Unable to select database");
  6. ?>
  7.  
  8. <form name="form" action="result.php" method="get">
  9.  
  10. Subject <input type="text" name="q" />
  11. Topic <input type="text" name="r" />
  12. Ability <input type="text" name="s" />
  13.  
  14. <input type="submit" name="Submit" value="Search" />
  15. </form>
  16.  
  17. <?php
  18. // Get the search variable from URL
  19. $q = $_GET['q'] ;
  20.  
  21. $r = $_GET['r'] ;
  22.  
  23. $s = $_GET['s'] ;
  24.  
  25. // Build SQL Query
  26. $myquery = "select * from lesson where subject like '%".$q."%' AND learningArea like '%".$r."%' AND ability like '%".$s."%'";
  27. //echo $myquery ;
  28. $result = mysql_query ($myquery);
  29.  
  30.  
  31. echo "<table>" ;
  32. echo "<tr><th>Lesson ID</th>";
  33. echo "<th>Subject</th>";
  34. echo "<th>Learning Area</th>";
  35. echo "<th>No of Students</th>";
  36. echo "<th>Time Period</th>";
  37. echo "<th>Class</th>";
  38. echo "<th>Ability</th></tr>";
  39.  
  40. while ($row= mysql_fetch_array($result))
  41. {
  42. $lessonID = $row["lessonID"];
  43. $subject = $row["subject"];
  44. $learningArea= $row["learningArea"];
  45. $noofstudent= $row["noofstudents"];
  46. $minutes= $row["minutes"];
  47. $class= $row["class"];
  48. $ability= $row["ability"];
  49.  
  50. //display the row
  51.  
  52. echo <<<EOD
  53. <tr>
  54. <td><a href="details.php?lessonID=$lessonID"> </a></td>
  55. <td>$subject</td>
  56. <td>$learningArea</td>
  57. <td>$noofstudents</td>
  58. <td>$minutes</td>
  59. <td>$class</td>
  60. <td> $ability</td>
  61. </tr>
  62. EOD;
  63. }
  64. echo "</table>";
  65.  
  66. ?>
Last edited by Josh Connerty; Jun 11th, 2009 at 1:10 am.
Reputation Points: 31
Solved Threads: 27
Unverified User
Josh Connerty is offline Offline
342 posts
since Apr 2009
Jun 11th, 2009
0

Re: make link from a variable.

tulipputih if your problem is solved then mark this forum as solved.
Reputation Points: 15
Solved Threads: 6
Junior Poster
navi17 is offline Offline
118 posts
since Oct 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Internationalization - MySQL queries
Next Thread in PHP Forum Timeline: cake php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC