dimanche 19 avril 2015

Laravel sqlite query error

Im receiving this error when i try and navigate to my comments page.

SQLSTATE[HY000]: General error: 25 bind or column index out of range

Heres the function that queries the database:

function statusAndcomments($id)
$sql = "Select * FROM status, comment WHERE user_Id = ?";
$results = DB::select($sql, array($id,$id));

return $results;

which is called in the route:

Route::get('comments_post/{id}', function($id)
$results = statusAndcomments($id);
return View::make('Social.comments_post')->withComments($results);

And here is the code that uses the contents from the database:

@forelse ($comments as $comment)
<div class="panel panel-default">

<div class="panel-heading">{{{ $comment->Name }}} - {{{ $comment->Title }}}</div>
<div class="panel-body">
<img class='ProfilePic' src='../Images/defaultProfile.jpg' alt='Profile Picture'>
<p>{{{ $comment->Message }}}</p>
<div class="panel-footer">
<form method="post" action="commentPoster">
<input name ="comment" class="form-control" AUTOCOMPLETE=OFF placeholder="Write a comment...">

<div class="panel panel-default">
<div class="panel-heading">{{{ $comment->comment.name }}}</div>
<div class="panel-body">
<p>{{{ $comment->comment.comment }}}</p>
<div class="panel-footer"></div>
No Posts

<a href="#" class="cd-top">Top</a>

Aucun commentaire:

Enregistrer un commentaire