Home >Backend Development >PHP Tutorial >php灵活的参数傳递_PHP

php灵活的参数傳递_PHP

WBOY
WBOYOriginal
2016-06-01 12:38:111094browse

在做网友評注時,通常我們是結合數据庫將文章的標題顯示出來并做好連接,之后便是評注的連接,

這裡因為每一萹文章都有不同的网友評注
,所以便要用到參數的傳遞使每一萹文章顯示不同的評注.



//****** 讀取數据庫數据,顯示文章標題*******

echo "

";

echo "";

$query="select * from knj order by id DESC";

$result = mysql_query($query,$id);

$nums = mysql_num_rows($result);

for($i=0; $i
{

if($i
{

$id=mysql_result($result, $i, "id");

$topic=mysql_result($result, $i, "topic");

$pp=$pp+1;

?>

TR>

//*******Value值用來存下文章的標題.********





//*******?后用來將$topic和$id傳遞到Pj.php******







}

}

echo "/TABLE>/form>";

?>



之后在Pj
.php中結合數据庫將id值為$id的數据讀出,便是該文章网友的評注,$topic用來輸出此文章的標題.

當然傳遞的方式不一定要用此法
,這裡只是我的一點拙見.


?>">

#003599"> echo $topic?>/FONT>

/TD>



//*******儘撜鼓獐u沒有用數据庫方式,這裡最好用數据庫方式.*******



?>">

嬝?lt;/a>


top" noWrap width="70" align="center">

#003399">

?>
&topic=echo $topic?>">評論



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn