Example
- include 'class-query.php';
- Initialized the Query class and chain parameters.
- Call run(), show() or get() as the last chained function. That is, run the query, show/"echo" the query or return the query;
require 'class-query.php';
$user_id=123456;
$q=new Query;
$q->select(
array(
'`user`.`user_id`',
'`user`.`name`',
'`user`.`email`'
)
)
->from('`user`')
->where_equal_to(
array(
'`user_id`'=>$user_id
)
)
->limit(1)
->run();
if($q){
$user=$q->get_selected();
echo
'Hello '.$user['name'].',<br />'.
'Your email is currently set to '.$user['email'].' '.
'and your user id is '.$user['user_id'].'.<br />'.
'';
}
else{
echo 'Sorry, user '.$user_id.' not found.';
}