dynamic link

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mushfiq
    New Member
    • Nov 2008
    • 5

    dynamic link

    hi all.i have faced a problem.


    input used:

    i have a mysql database named form.there is a table named dynamic.

    three attributes here

    id ( primary key,auto increment)
    name.
    company.


    Expected result:

    i want to show the data of the name field and make them a link to go to another page as like as:

    mushfiq
    mishuk

    the two above name will used to go to the page "dynamic2.p hp" .As for example ,if i click on mushfiq,the url will be "dynamic2.p hp" & in that show the company where mushfiq works.but

    mushfiq
    mishuk

    is not showed by ..

    error codes:

    Parse error: syntax error, unexpected $end in c:\wamp\www\dyn amic.php on line 33


    [ code ]


    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <?php
    mysql_connect(" localhost", "root", "");
    mysql_select_db ("form");
    $result=mysql_q uery("select name from dynamic") or die(mysql_error ());

    if(mysql_num_ro ws($result)==0)
    {
    echo "database is empty <br>";
    } else
    {
    while(list($id, $name)=mysql_fe tch_array($resu lt))
    {
    ?>
    <a href="dynamic2. php?id=<?php $id ?>"> <?php echo $name; ?> </a> <br >

    <?php
    }

    ?>
    </body>
    </html>

    [code]

    may be problem is in that line:

    <a href="dynamic2. php?id=<?php $id ?>"> <?php echo $name; ?> </a> <br >


    but i m not sure.if anyone can help me, i will be greatful.
Working...