0
我想 '而' 來選擇值,但療法是problam,這是代碼:從表中選擇值並按while顯示
<?php
$following_select_article = mysql_query("SELECT * FROM follow WHERE user_follower_id='$user_id'");
while($following_select_article_row = mysql_fetch_array($following_select_article)) {
$article_following_user_id = $following_select_article_row['user_following_id'].",";
$mmnnss = substr_replace($article_following_user_id, "", -1);
$echo $mmnss;
}
注$user_id = 1
所需的輸出是
2,3,4
但我得到的是
的DB是這樣的:
如下表:
ID | user_follower_id | user_following_id
1 | 1 | 2
2 | 1 | 4
3 | 1 | 3
感謝
非常感謝你第一次的答案和第二的編輯我的問題:) –
不客氣, – zzlalani
無需'substr_replace(...)',只需使用'substr($ str,0,-1);' –