Generating link in loop

-1

I want to generate links with the results of a database search. How to do this? In this case, I want to generate the link in the $ numped result.

//loop
while($linha=$sql->fetch(PDO::FETCH_ASSOC)){

    //pegando o dado dos campos...                
    $numped = $linha["numped"];
    $data = $linha["data"];
    $vencto = $linha["vencto"];
    $status = $linha["desc_status"];

    //montando a table...
    echo '<tr>';
    echo '<td>' .  $numped . '</td>';
    echo '<td>' .  $data . '</td>';
    echo '<td>' .  $vencto . '</td>';
    echo '<td>' .  $status . '</td>';
    echo '</tr>';

}
    
asked by anonymous 30.06.2018 / 03:13

1 answer

0

What kind of value is returned with $ numped ??

If you want $ numped to be a link, just do so

echo '<td><a href"#">' .  $numped . '</a></td>';

replacing the # with the URI of the link you want, if the $ numped property itself is the link do so

echo '<td><a href"'.$numped.'">' .  $numped . '</a></td>';

post more details to help you better.

    
30.06.2018 / 16:57