Php laravel中的sqlite行数据增量
使用Laravel和sqlite,我试图增加一个值,该值表示下一页上有多少评论。我遇到的问题是需要增加的值在按钮中作为“标签”,因此我无法使用Php laravel中的sqlite行数据增量,php,sqlite,laravel,Php,Sqlite,Laravel,使用Laravel和sqlite,我试图增加一个值,该值表示下一页上有多少评论。我遇到的问题是需要增加的值在按钮中作为“标签”,因此我无法使用Input::get('commentCounter')从中提取值 以下是我删除并发布评论时调用的函数: function commentcountdelete($id){ $commentcounter = Input::get('commentcounter'); $sql = "Update status Set commentCou
Input::get('commentCounter')
从中提取值
以下是我删除并发布评论时调用的函数:
function commentcountdelete($id){
$commentcounter = Input::get('commentcounter');
$sql = "Update status Set commentCount = ?-1 WHERE id = ?";
$results = DB::update ($sql, array($commentcounter,$id));
return $results;
}
function commentcountIncrement($id){
$commentcounter = Input::get('commentcounter');
$sql = "Update status Set commentCount = ?+1 WHERE id = ?";
$results = DB::update ($sql, array($commentcounter,$id));
return $results;
}
以下是需要从中提取值的位置:
<a href ="{{{ url("comments_post/$post->Id") }}}"><button id="commentBTN" type="button" class="btn btn-default">Comments: {{{$post->commentCount}}}</button></a>
将此添加到routes.php中
Route::post('comments_post/{commentcounter}', '{your Controller}@{your view}');
它将向您的控制器发送id,您将能够使用该id