많은 사이트를 검색했지만 mysql으로 작성한 쿼리로 링크를 생성하는 방법을 찾을 수 없습니다.mysql에서 쿼리로 링크 만들기
누군가가 coureurname을 클릭하면 다른 페이지로 리디렉션되지만이 쿼리 결과에서 클릭 가능한 링크를 만드는 방법을 원합니다. 아래에 PHP 코드로 쿼리를 게시했습니다.이 작업을 수행하는 방법을 모르기 때문에 여러분이 도와 줄 수 있기를 바랍니다. echo($row[$fieldindex]);
링크를 포함한다고 가정
<html>
<title> lijstcoureur</title>
<head>
<H1> LIJST VAN COUREURS </H1>
</head>
<?php
$con=mysql_connect('localhost','root','****')
or die ('Kan geen verbinding maken met mySQL server');
$db=mysql_select_db('formule1',$con)
or die ('Kan de database niet selecteren');
$selectie=mysql_query("CALL lijstcoureurs()",$con);
if(!selectie)
die('Invalid query:'.mysql_error());
?>
<table border =1>
<thead>
<tr>
<?php
for($fieldindex=0;$fieldindex<mysql_num_fields($selectie);$fieldindex++)
{
echo '<th>';
echo mysql_field_name($selectie,$fieldindex);
echo '</th>';
}
?>
</tr>
</thead>
<tbody>
<?php
/*
Loop alle rijen langs en sla het resultaat op in variable $row */
while($row=mysql_fetch_array($selectie))
{
// Begin een nieuwe rij
echo('<tr>');
// Loop alle rijen langs en zet de inhoud in de tabel
for($fieldindex=0;$fieldindex<mysql_num_fields($selectie);$fieldindex++)
{
echo('<td>');
echo($row[$fieldindex]);
echo('</td>');
}
echo('</tr>');
}
?>
</tbody>
</table>
</body>
</html>
mysql_ * 함수는 [PHP 5.5에서 더 이상 사용되지 않음] (http://php.net/manual/en/faq.databases.php#faq.databases.mysql.deprecated)이 될 것입니다. 나중에 제거 될 예정이므로 새 코드를 작성하는 것은 권장되지 않습니다. 대신 [MySQLi] (http://php.net/manual/en/book.mysqli.php) 또는 [PDO] (http://php.net/manual/en/book.pdo.php) 및 [더 나은 PHP 개발자가 되십시오] (http://jason.pureconcepts.net/2012/08/better-php-developer/). –