PHP Classes

Bind Params in PDO

Recommend this page to a friend!

      PDO Paginate  >  All threads  >  Bind Params in PDO  >  (Un) Subscribe thread alerts  
Subject:Bind Params in PDO
Summary:I can't use bound params with the class
Messages:2
Author:Ovidiu Androne
Date:2014-03-20 00:35:03
Update:2014-03-20 16:45:58
 

  1. Bind Params in PDO   Reply   Report abuse  
Picture of Ovidiu Androne Ovidiu Androne - 2014-03-20 00:35:03
Greetings,

I am a beginner with php. I don't understand what I do wrong; without bound params, class works fine, all is perfect, but when I try to use bound values or params, the query fails to execute. My code is here:

$options = array(
'results_per_page' => 6,
'url' => '?page=*VAR*',
'db_handle' => $conn,
'using_bound_values' => true,
'text_prev' => '<',
'text_next' => '>',
'text_first' => '«',
'text_last' => '»',
'current_page_is_link' => false,
'max_links_between_ellipses' => 5,
'show_links_prev_next_if_dead' => false
)

try {
$paginate = new pagination($page, 'SELECT * FROM aforisme ORDER BY data ?', $options);
}
catch(paginationException $e) {
echo $e;
exit();
}

$paginate->bindValue(1, 'ASC', PDO::PARAM_STR);

$paginate->execute();


/*
* If we get a success, carry on
*/
if($paginate->success == true)
{

/*
* Fetch our results
*/
$result = $paginate->resultset->fetchAll();





Thank you!
}

  2. Re: Bind Params in PDO   Reply   Report abuse  
Picture of Ovidiu Androne Ovidiu Androne - 2014-03-20 16:45:58 - In reply to message 1 from Ovidiu Androne
i solved it ..................