Re: [PHP-DB] Prepared Statement not working (mysql 5)

2005-07-19 Thread Georg Richter
Am Do, den 14.07.2005 schrieb Marco Bascietto um 13:15:

 
 It looks like there is a problem with mysqli PS when the client and the
 server share the same machine. 
 Does anyone have a clue on what is going on or point me to some tests I
 can do?
 

There is no problem when running client and server on the same machine.
The only problem seems to be that you don't have any error handling in
your script: mysqli_connect_error and mysqli_error are your friends!

Also there is no need for an additional call $mysql-select_db, you can
select default db already during connect.

/Georg

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Prepared Statement not working (mysql 5)

2005-07-14 Thread Marco Bascietto
Hello list,

The following example script uses prepared statements to bind input and
output parameters It works flowlessy using php 5  mysqli on a client
machine and MySQL 5.0.7 beta on the server (192.168.0.2):

1: ?php 
2: $m = new mysqli('192.168.0.2', 'xxx', 'xxx');
3: $m-select_db('xxx');
4: 
5: $sql = SELECT des FROM comune WHERE descrizione LIKE ?;
6: $param='tre%';
7: 
8: $stmt = $m-stmt_init();
9:
10: if ($stmt-prepare($sql)) {
11:
12: $stmt-bind_param('s', $param);
13: $stmt-execute();
14: $stmt-bind_result($col1);
15: 
16: echo p;
17: while ($stmt-fetch()) {
18: echo $col1br/;
19: }
20: echo /p;
21: 
22: $stmt-close();
23: }
24: 
25: $m-close();
26: 
27: ?

Now, upon moving the script on to the server and replacing line 2 with 
2: $m = new mysqli('localhost', 'xxx', 'xxx');
it stops working (ie no output at all on screen). 

Removing the bound output parameter (line 14) results in a mock too
many parameters to bind_param error on line 12.
Replacing the PS with a simple query makes the script work again.
The PS at the mysql command interface level is working as expected.

It looks like there is a problem with mysqli PS when the client and the
server share the same machine. 
Does anyone have a clue on what is going on or point me to some tests I
can do?

Thank you all,
marco

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php