dimanche 24 avril 2016

trying to get property of non-object 4

I've tried using the following code to get a record from a sql table which triggers the error on the last line. "postid" has a value of 2

//Fetches Temporary Storage space
$sql = "select postid from postrefresh where id = 1;";
$postrefresh = DB::select($sql);

//creates temporary variable holding the post
$sql = "select * from posts where id = ?";
$post = DB::select($sql, array($postrefresh->postid));

Aucun commentaire:

Enregistrer un commentaire