PDO Problem. Execute arguments not being read?

mikaelch

New Member
Here is my function to return the most popular videos. For some reason it don't acknowledge the :limit. If I remove ':limit' and implicitly put in the number 10 it works.Method:\[code\]function getPopularVideos($limit) {$dbc = connectToDatabase();$q = $dbc->prepare('SELECT * FROM video ORDER BY views DESC LIMIT 0, :limit');$q->execute(array(':limit' => $limit));return $q->fetchAll(PDO::FETCH_ASSOC);}\[/code\]Calling code:\[code\]$popularVideos = getPopularVideos(10);\[/code\]Any idea's what I'm doing wrong. Little confused.
 
Back
Top