Generating a loop link

Asked

Viewed 37 times

-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 result $numped.

//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>';

}
  • 1

    Show what you’ve tried

  • Is $numped a link? Shows an example of what it returns.

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 # with the URI of the link q you want, if $numped is the link itself do so

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

post more details to help you better.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.