[prev in list] [next in list] [prev in thread] [next in thread]
List: php-gtk-dev
Subject: [PHP-GTK-DEV] Bug #52023 [Opn->Bgs]: mysqli prepared statements not working with PHP-GTK
From: auroraeosrose () php ! net
Date: 2010-06-08 15:15:32
Message-ID: 20100608151533.E0E90F0B () ez1 ! php ! net
[Download RAW message or body]
Edit report at http://bugs.php.net/bug.php?id=52023&edit=1
ID: 52023
Updated by: auroraeosrose@php.net
Reported by: james dot bradley at simunix dot com
Summary: mysqli prepared statements not working with PHP-GTK
-Status: Open
+Status: Bogus
Type: Bug
Package: PHP-GTK related
Operating System: Windows Vista
PHP Version: Irrelevant
New Comment:
Cannot reproduce:
Mysql 5.1 on windows 7
user testuser with rights to the testschema
PHP-GTK 2.0.1 from gtk.php.net, PHP 5.2.13 NTS from PHP.net downloaded
and dropped over the 2.0.1 package to get the mysqli extension
php-cli.ini edited, added extension=php_mysqli.dll
php -m from the php-gtk2 directory includes mysqli
Following code works perfectly
<?php
$mysqli = new mysqli('localhost', 'testuser', 'testuser',
'testschema');
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
$num = 3;
$name = null;
if($stmt = $mysqli->prepare("SELECT test FROM new_table WHERE
idnew_table < ?")) {
$stmt->bind_param('i', $num);
$stmt->bind_result($name);
$stmt->execute();
while($stmt->fetch()) {
echo $name;
}
} else {
echo $mysqli->error;
}
Check your php-gtk setup. Add some error handling to your code to see
if that if loop is actually even being entered, and check for a prepare
error.
Previous Comments:
------------------------------------------------------------------------
[2010-06-08 14:59:59] james dot bradley at simunix dot com
Description:
------------
Normal mysqli queries work fine with PHP-GTK but prepared statements
never return any rows from a query. I have tested the same prepared
statement code outside of PHP-GTK in a WAMP installation and there it
runs fine, indicating it is more than likely a bug with mysqli prepared
statements and PHP-GTK. Note that even "SELECT name from saved_data"
with no conditions doesn't work as a prepared statement so the problem
is not with bind_param.
Test script:
---------------
// runs fine in PHP-GTK and WAMP
if($result = $mysqli->query("SELECT name FROM saved_data WHERE
data_id<10")) {
while ($row = $result->fetch_object()) echo $row->name;
}
// doesn't work in PHP-GTK (does work in WAMP)
$num = 10;
if($stmt = $mysqli->prepare("SELECT name FROM saved_data WHERE
data_id<?")) {
$stmt->bind_param("i", $num);
$stmt->bind_result($name);
$stmt->execute();
while($stmt->fetch()) {
echo $name;
}
}
Expected result:
----------------
The same output should be generated from both of the above scripts.
Actual result:
--------------
The non-prepared statement outputs the expected rows, the prepared
statement does not.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52023&edit=1
--
PHP-GTK Development Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic