| | |
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
php Syntax (Toggle Plain Text)
echo "<tr> <td><a href='details.php?lessonID=$lessonID'>Details</a></td> <td>$subject</td> <td>$learningArea</td> <td>$noofstudents</td> <td>$minutes</td> <td>$class</td> <td> $ability</td> </tr>" ;
•
•
Join Date: Jun 2009
Posts: 68
Reputation:
Solved Threads: 10
this is a typo error in your SQL query then
and,
the SQL save version is this:
•
•
•
•
..........
it should be:
........PHP Syntax (Toggle Plain Text)
$myquery = "select * from lesson where subject like '%'.$q.'%' AND learningArea like '%'.$r.'%' AND ability like '%'.$s.'%'";
the SQL save version is this:
php Syntax (Toggle Plain Text)
$q = isset($_GET['q'])? mysql_real_escape_string($_GET['q']):''; $r = isset($_GET['r'])? mysql_real_escape_string($_GET['r']):''; $s = isset($_GET['s'])? mysql_real_escape_string($_GET['s']):''; // Build SQL Query $myquery = "select * from lesson where subject like '%{$q}%' AND learningArea like '%{$r}%' AND ability like '%{$s}%'";
•
•
Join Date: Oct 2007
Posts: 78
Reputation:
Solved Threads: 5
try this:
i am sure it works.
PHP Syntax (Toggle Plain Text)
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 <tr> <td><a href="details.php?lessonID=<?php echo $lessonID; ?>"> Details</a></td> <td><?php echo $subject; ?></td> <td><?php echo $learningArea; ?></td> <td><?php echo $noofstudents; ?></td> <td><?php echo $minutes; ?></td> <td><?php echo $class; ?></td> <td><?php echo $ability; ?> </td> </tr> <?php } ?> </table>
i am sure it works.
Last edited by navi17; Jun 10th, 2009 at 9:18 am.
•
•
Join Date: Jun 2009
Posts: 68
Reputation:
Solved Threads: 10
Last edited by djjjozsi; Jun 10th, 2009 at 9:36 am.
•
•
Join Date: May 2009
Posts: 81
Reputation:
Solved Threads: 0
•
•
•
•
try this:
PHP Syntax (Toggle Plain Text)
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 <tr> <td><a href="details.php?lessonID=<?php echo $lessonID; ?>"> Details</a></td> <td><?php echo $subject; ?></td> <td><?php echo $learningArea; ?></td> <td><?php echo $noofstudents; ?></td> <td><?php echo $minutes; ?></td> <td><?php echo $class; ?></td> <td><?php echo $ability; ?> </td> </tr> <?php } ?> </table>
i am sure it works.
Hi Navi17.
thanks a lot..can be linked to details page.
however, the Id number is not shown in the result..
all show the same string..details..but the lesson Id that sent to details page is correct (the lessonID)
just the Id is not displayed in the table.
any idea to correct it?
thanks
•
•
Join Date: May 2009
Posts: 81
Reputation:
Solved Threads: 0
•
•
•
•
i've seen your first version, and in that post i did not see the <?php echo $field... ; ?>
which needed to print the values.
if i saw it wrong then sorry about it.
the code that I posted before also print data from the database..
The problem is to make a link to the details page.
now, Navi17 has solved that problem..however the ID is not printed here..but the value is passed to the details page... I need both..the lessonID printed & the value passed.
ANy solution. Mny thanks for your respond
![]() |
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
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube






