1. Go to this page and download the library: Download mstone121/php-object-sql library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mstone121 / php-object-sql example snippets
$query = "SELECT question.id, qr.id, qr.response_label
FROM questions q
LEFT JOIN question_responses qr ON qr.question_id = q.id";
if ($questionIds) {
$query .= "WHERE q.id IN ('" . implode("','", $questionIds) . "')";
}
$query .= " ORDER BY q.id, qr.id";
$query = new QString(
new QSelect([
'q.id',
'qr.id',
'qr.label'
]),
new QFrom('questions'),
new QJoinsCollection(
new QJoinOn(
'question_responses qr',
'qr.question_id = q.id',
'LEFT'
)
),
new QOrder(['q.id', 'qr.id'])
);
if ($questionIds) {
$query->addComponent(
new QWhere(
new QAnd(
new QIn('q.id', $questionIds)
)
)
);
}
new QString(
new QSelect([
"1; TRUNCATE questions; SELECT *"
]),
new QFrom('questions')
)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.