Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread Flavio daCosta
On 11/05/2007 08:34 PM, Michael Southwell wrote: > One last question: when affected_rows returns -1 (according to the docs) > it "indicates that the query returned an error." My example demonstrates > this by throwing an exception here: > if ( $demo -> affected_rows == -1 ) throw new Exception (

Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread John Campbell
I think the best example of how to make prepared statements fail is to try something like this: SELECT name FROM wines WHERE ?='red'; This will result in an error. If you think about what is going on behind the scenes, it should be clear why. Regards, John Campbell __

Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread Dan Cech
Michael Southwell wrote: > I have a mysqli script which works perfectly except when I try to force > an exception > by using a test attacking parameter. I can't get an exception thrown > even though I also > don't get any output. The docs say the prepared statement must be a > single statement, and

[nyphp-talk] Lurker creeping out of the shadows

2007-11-05 Thread enigma
Hi everyone, I've been lurking since March and have decided that it's time to at least introduce myself. I've been coding HTML since 1997 (self-taught) and worked for a webdev company during the latter part of dotcom boom. I got interested in graphic design, so after everything went bust I switc

Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread Michael Southwell
Flavio daCosta wrote: This is a perfect example of why prepared statements are so much better for SQL injection avoidance than straight SQL calls. Exactly why I'm working on understanding the mechanism behind it, so I can explain it rather than just demonstrating it. One last question: whe

Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread Flavio daCosta
On 11/05/2007 06:14 PM, Michael Southwell wrote: > aha, so 'SELECT name FROM wines WHERE color = "red";DELETE FROM wines' > is two statements in mysql (failing with msyql_query) but one in mysqli?!?! Correct, mysql_query() processes a string: 'SELECT name FROM wines WHERE color = "red";DELETE FROM

Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread Michael Southwell
Flavio daCosta wrote: On 11/05/2007 05:16 PM, Michael Southwell wrote: /snip The docs say the prepared statement must be a single statement, and of course this is not. But why don't I get an exception here? Your /prepare/d statement is a single statement. aha, so 'SELECT name FROM wines WHER

[nyphp-talk] Phpspec (BDD)

2007-11-05 Thread Jon Baer
BDD is just too cool (and productive) to ignore :-) http://code.google.com/p/phpspec/ No downloads yet except w/ what is in trunk ... svn checkout http://phpspec.googlecode.com/svn/trunk/phpspec Hope it picks up some traction + someone can present sometime ... - Jon __

Re: [nyphp-talk] mysqli exception problem

2007-11-05 Thread Flavio daCosta
On 11/05/2007 05:16 PM, Michael Southwell wrote: /snip > The docs say the prepared statement must be a > single statement, and of course > this is not. But why don't I get an exception here? Your /prepare/d statement is a single statement. You have bound 'red;DELETE FROM wines' to your parameter,

[nyphp-talk] mysqli exception problem

2007-11-05 Thread Michael Southwell
I have a mysqli script which works perfectly except when I try to force an exception by using a test attacking parameter. I can't get an exception thrown even though I also don't get any output. The docs say the prepared statement must be a single statement, and of course this is not. But why d