By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,434 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

mysqli problem with stmt and binding parameters.

P: n/a
I have a website that I was moving from another server to mine for
somebody. This website uses mysqli functions.

mysqli extensions are installed on my Linux server, PHP is 5.1.6 and
and MySQL is 4.1.22 (both higher than his server).

All seems to work fine, but any statement that uses the bind (i.e.
placing a ? in the sql statement, and then binding variables to it)
does not work in my server, only his.

Two questions, comparing phpinfo() on both servers, I can't find any
differences that would cause this problem. Does anyone have any ideas
on where to look?

And two, does anyone know how I can echo the prepared sql statement so
I can see what the final product looks like that gets sent to MySQL?

Jul 30 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
sugapablo wrote:
I have a website that I was moving from another server to mine for
somebody. This website uses mysqli functions.

mysqli extensions are installed on my Linux server, PHP is 5.1.6 and
and MySQL is 4.1.22 (both higher than his server).

All seems to work fine, but any statement that uses the bind (i.e.
placing a ? in the sql statement, and then binding variables to it)
does not work in my server, only his.
"Does not work" is pretty broad. What do you expect to happen? What
actually happens? What error messages do you get?
Two questions, comparing phpinfo() on both servers, I can't find any
differences that would cause this problem. Does anyone have any ideas
on where to look?

And two, does anyone know how I can echo the prepared sql statement so
I can see what the final product looks like that gets sent to MySQL?
No, prepared statements are resources and can't be echo'd.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 30 '07 #2

P: n/a
On Mon, 30 Jul 2007 09:13:15 -0700, sugapablo <su*******@hotmail.comwrote:
>I have a website that I was moving from another server to mine for
somebody. This website uses mysqli functions.

mysqli extensions are installed on my Linux server, PHP is 5.1.6 and
and MySQL is 4.1.22 (both higher than his server).
How much higher is the MySQL - presumably just the minor version?
>All seems to work fine, but any statement that uses the bind (i.e.
placing a ? in the sql statement, and then binding variables to it)
does not work in my server, only his.
In what way does it not work? Errors? Blank pages? Flame pouring out the back
of the computer?

Usual drill: put error_reporting to maximum, make sure you're not suppressing
errors with "@".
>Two questions, comparing phpinfo() on both servers, I can't find any
differences that would cause this problem. Does anyone have any ideas
on where to look?

And two, does anyone know how I can echo the prepared sql statement so
I can see what the final product looks like that gets sent to MySQL?
If you're using mysqli, and you're expecting to see an SQL statement with the
values embedded and escaped into it, actually the statement with placeholders
/is/ the final product sent to MySQL - MySQL 4.x+ supports placeholders
natively.

If you were just after the SQL, then find the place where prepare() gets
called, and add some debugging there.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jul 30 '07 #3

P: n/a
On Jul 30, 1:30 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
"Does not work" is pretty broad. What do you expect to happen? What
actually happens? What error messages do you get?
I wasn't sure at first, but I can now tell, based on what is being
returned that the the parameters being binded are blank.

So if the SQL statement was "SELECT * FROM table WHERE col = ?"

What would be passed to the server after trying to bind a string
variable would be "SELECT * FROM table WHERE col = ''"
Jul 30 '07 #4

P: n/a
sugapablo wrote:
On Jul 30, 1:30 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>"Does not work" is pretty broad. What do you expect to happen? What
actually happens? What error messages do you get?

I wasn't sure at first, but I can now tell, based on what is being
returned that the the parameters being binded are blank.

So if the SQL statement was "SELECT * FROM table WHERE col = ?"

What would be passed to the server after trying to bind a string
variable would be "SELECT * FROM table WHERE col = ''"

It could be a lot of things. But not seeing any code I wouldn't begin
to be able to tell you what the problem is.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 30 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.