Skip to content

Commit

Permalink
Update manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamshory, MT committed Oct 31, 2024
1 parent 053407b commit 1091b78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
21 changes: 2 additions & 19 deletions manual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2255,16 +2255,7 @@ <h4>Constructor</h4>
echo "Debugging query: $sqlQuery\n";
echo "Parameters: " . json_encode($params) . "\n";
});

// Example usage of the database connection
if ($db-&gt;connect()) {
// Fetch a user by ID, triggering the execute callback
$user = $db-&gt;fetch("SELECT * FROM users WHERE id = ?", [1]);
print_r($user);

// Disconnect
$db-&gt;disconnect();
}</code></pre>
</code></pre>
<p><strong>Disabling Callbacks Using Setters</strong></p>
<p>You can also disable the callbacks by setting them to <code>null</code>:</p>
<pre><code class="language-php">// Instantiate PicoDatabase
Expand All @@ -2273,15 +2264,7 @@ <h4>Constructor</h4>
// Disable callbacks
$dbWithoutCallbacks-&gt;setCallbackExecuteQuery(null);
$dbWithoutCallbacks-&gt;setCallbackDebugQuery(null);

// Use the database as usual without callback outputs
if ($dbWithoutCallbacks-&gt;connect()) {
$user = $dbWithoutCallbacks-&gt;fetch("SELECT * FROM users WHERE id = ?", [1]);
print_r($user);

// Disconnect
$dbWithoutCallbacks-&gt;disconnect();
}</code></pre>
</code></pre>
<h4>Connecting to the Database</h4>
<pre><code class="language-php">public function connect($withDatabase = true): bool</code></pre>
<p><strong>Parameters</strong>:</p>
Expand Down
17 changes: 0 additions & 17 deletions tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2602,15 +2602,6 @@ $db->setCallbackDebugQuery(function($sqlQuery, $params) {
echo "Parameters: " . json_encode($params) . "\n";
});

// Example usage of the database connection
if ($db->connect()) {
// Fetch a user by ID, triggering the execute callback
$user = $db->fetch("SELECT * FROM users WHERE id = ?", [1]);
print_r($user);

// Disconnect
$db->disconnect();
}
```

**Disabling Callbacks Using Setters**
Expand All @@ -2625,14 +2616,6 @@ $dbWithoutCallbacks = new PicoDatabase($credentials);
$dbWithoutCallbacks->setCallbackExecuteQuery(null);
$dbWithoutCallbacks->setCallbackDebugQuery(null);

// Use the database as usual without callback outputs
if ($dbWithoutCallbacks->connect()) {
$user = $dbWithoutCallbacks->fetch("SELECT * FROM users WHERE id = ?", [1]);
print_r($user);

// Disconnect
$dbWithoutCallbacks->disconnect();
}
```

#### Connecting to the Database
Expand Down

0 comments on commit 1091b78

Please sign in to comment.