[php] Link

Gestart doorAlemaalte4 reacties40 weergaven

5 berichten · pagina 1 van 1

Alemaalte

Lid · Topicstarter

Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zou in een tabel een link willen met een variable maar het lukt me niet.

Hier een stukje code.

[COLOR= #0000BB]<?php[/COLOR]
    [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"safe.php"[/COLOR][COLOR= #007700]);[/COLOR]


        [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM advertenties"[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]);[/COLOR]


    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700]){[/COLOR]
?>

Irrelevante html-code.

[COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR] ?>

Irrelevante html-code.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<table border=0>
<tr>
<th>Naam v/d advertentie</th>
<th>Beschrijving</th>
<th>Punten die je krijgt</th>
<th>Punten die nog over zijn</th>
<th>Info + link</th>
</tr>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]))
{[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<tr>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<td>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]"</td>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<td>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]beschrijving[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]"</td>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<td>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]punten[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]"</td>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<td>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]punten_over[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]"</td>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<td>"[/COLOR][COLOR= #007700];[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</td>"[/COLOR][COLOR= #007700];[/COLOR]
  [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</tr>"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</table>"[/COLOR][COLOR= #007700];[/COLOR]


?>
</div>
</body>
</html>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>


echo "" . $row[punten_over] . "";
echo ""; echo $row[id]; echo "";
echo "";

De $row[id] is de variable.
Het vetgedrukte is het belangrijkste.
en het schuingedrukte is de variable die in de url moet komen.

v.b. van de url:
http://www.mijnwebsite.nl/gggg.php?a=variable
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
echo "<td><a href="http://www.mijnwebsite.nl/gggg.php?a=".$row[id]."" target="_blank">http://www.mijnwebsite.nl/gggg.php?a=".$row[id]."</a></td>";


zoiets?
0
Alemaalte

Lid · Topicstarter

Berichten
5.957
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt bloos
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Sjoerd schreef:
echo "<td><a href="http://www.mijnwebsite.nl/gggg.php?a=".$row[id]."" target="_blank">http://www.mijnwebsite.nl/gggg.php?a=".$row[id]."</a></td>";
zoiets?

Waarom dubbele quotes gebruiken, is alleen maar meer werk om te escapen.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rik schreef:
Eerdere citaten tonen
Sjoerd schreef:
echo "<td><a href="http://www.mijnwebsite.nl/gggg.php?a=".$row[id]."" target="_blank">http://www.mijnwebsite.nl/gggg.php?a=".$row[id]."</a></td>";
zoiets?
Waarom dubbele quotes gebruiken, is alleen maar meer werk om te escapen.

deed die gast ook al ? emoik ga niet een beetje zijn script veranderen zodat hij het niet meer snapt puh2
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren