cancel
Showing results for 
Search instead for 
Did you mean: 

PHP functions for prepared statements with labels instead of question marks

Former Member
0 Kudos
4,711

In most databases (MSSSQL, Postgre, MySql, etc...) I can use prepared statements with labels instead of "?" question marks. It's even possible to bind more than one parameter without respecting the order of parameters. Example using PHP's PDO:

$dbh = new PDO(' ** connection dsn ** ');
$stmt = $dbh->prepare('SELECT * FROM products WHERE product_status = :statusid AND product_code = :productcode');
$stmt->execute(array(
    ':productcode' => 'ABCDEF',
    ':statusid' => 123,
));


Is there a way to obtain the same behaviour also on SQLAnywhere functions? It would be more confortable using parameters labels instead of question marks '?'.

Accepted Solutions (0)

Answers (1)

Answers (1)

If you are more comfortable using PDO to access data, you could try the SQL Anywhere PDO Driver

Former Member
0 Kudos

Does this driver manage the parameters by itself internally simulating the DBMS behaviour (sending to the database only the final "valued" query), or does it send the parameters right to the database along with the statement?

0 Kudos

The input/output parameters are bound using the sqlany_bind_param method. Statements are executed using the sqlany_execute method. The actual parameters should be sent as host variables separate from the statement.