Using Conn() and prepared statements

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
yaaryvp
User
Posts: 14

Using Conn() and prepared statements

Post by yaaryvp »

Hello,

I used to connect with custom file to data using:

$db =& DbHelper();
$sql = "SELECT * from products;";
$result = $db->ExecuteRows($sql);

Now that this is depreciated, I try using

$conn = Conn();
$resultSet = $conn->executeQuery("SELECT * from products;");


echo "<pre>";
var_dump($resultSet);
echo "</pre>";

But i get the full object with password and username when I var_dump $resultSet

What am I doing wrong?


yaaryvp
User
Posts: 14

Post by yaaryvp »

The reason I wanted to use Conn() is seeing it supports prepared statements as such:

$count = $conn->executeStatement("UPDATE user SET username = ? WHERE id = ?", ["jwage", 1]); // Executes a prepared statement 

Do you happen to have an example of using prepared statements.
ty


arbei
User
Posts: 9787

Post by arbei »

You may read Using Prepared Statements.

Note: Conn() returns DBAL connection object.


Post Reply