| | |
make link from a variable.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 68
Reputation:
Solved Threads: 10
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
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)
echo "<tr> <td><a href='details.php?lessonID=$lessonID'>Details for $subject( $lessonID )</a></td> <td>$subject</td> <td>$learningArea</td> <td>$noofstudents</td> <td>$minutes</td> <td>$class</td> <td> $ability</td> </tr>" ;
PHP Syntax (Toggle Plain Text)
<?php mysql_connect("localhost","root",""); mysql_select_db("student") or die("Unable to select database"); ?> <form name="form" action="result.php" method="get"> Subject <input type="text" name="q" /> Topic <input type="text" name="r" /> Ability <input type="text" name="s" /> <input type="submit" name="Submit" value="Search" /> </form> <?php // Get the search variable from URL $q = $_GET['q'] ; $r = $_GET['r'] ; $s = $_GET['s'] ; // Build SQL Query $myquery = "select * from lesson where subject like '%".$q."%' AND learningArea like '%".$r."%' AND ability like '%".$s."%'"; //echo $myquery ; $result = mysql_query ($myquery); echo "<table>" ; echo "<tr><th>Lesson ID</th>"; echo "<th>Subject</th>"; echo "<th>Learning Area</th>"; echo "<th>No of Students</th>"; echo "<th>Time Period</th>"; echo "<th>Class</th>"; echo "<th>Ability</th></tr>"; while ($row= mysql_fetch_array($result)) { $lessonID = $row["lessonID"]; $subject = $row["subject"]; $learningArea= $row["learningArea"]; $noofstudent= $row["noofstudents"]; $minutes= $row["minutes"]; $class= $row["class"]; $ability= $row["ability"]; //display the row echo <<<EOD <tr> <td><a href="details.php?lessonID=$lessonID"> </a></td> <td>$subject</td> <td>$learningArea</td> <td>$noofstudents</td> <td>$minutes</td> <td>$class</td> <td> $ability</td> </tr> EOD; } echo "</table>"; ?>
Last edited by Josh Connerty; Jun 11th, 2009 at 1:10 am.
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.
My Liveperson: http://liveperson.com/josh-connerty/
My Liveperson: http://liveperson.com/josh-connerty/
![]() |
Similar Threads
- Want to make a Link Management system (PHP)
- default variable as a pointer in class (C++)
- Maximum possible nodes in any link list (C++)
- need to make a link (PHP)
Other Threads in the PHP Forum
- Previous Thread: Internationalization - MySQL queries
- Next Thread: cake php
Views: 1036 | Replies: 22
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl customizableitems database date directory display download dynamic echo email error file files folder form format forms forum function functions google headmethod href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail malfunctioning menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube





