Re: to ora_bind or not to ora_bind

From: Date: Wed, 03 Apr 2002 13:17:13 +0000
Subject: Re: to ora_bind or not to ora_bind
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18157@lists.php.net to get a copy of this message
Don't forget to quote the strings and run addslashes. "Christian Schneider" <schneider@rrz.uni-koeln.de> wrote in message news:3CAAF592.9030701@rrz.uni-koeln.de... > Hi, > > sorry to post just after subscribing but I didn't find anything in the faqs. > > I have to port an Oracle-based system to MySQL and am now investigating > how to get rid of the Oracle specialities. I neither wrote the system > nor do I fully understand how it's working yet, so I might miss something. > > The biggest trouble spot seems to be the use of the ora_bind functions > as in the following example: > > $e = db_parse ($curs, "insert into usercomments values > "."(:pkey,:pser,:pnam,:pema,:pdat,:ptxt,:psub,:pref) ") > > if ( ! $e ): > $err = "Error in insert statement!"; > $errn = $curs; > else: > db_bind ($curs, "param_key", ":pkey", 6, 1); > db_bind ($curs, "param_ser", ":pser", 16, 1); > db_bind ($curs, "param_nam", ":pnam", 128, 1); > db_bind ($curs, "param_ema", ":pema", 128, 1); > db_bind ($curs, "param_dat", ":pdat", 64, 1); > db_bind ($curs, "param_txt", ":ptxt", 1024, 1); > db_bind ($curs, "param_sub", ":psub", 128, 1); > db_bind ($curs, "param_ref", ":pref", 16, 1); > if (!db_exec ($curs)): > $err = "Could not execute insert statement, sorry!"; > $errn = $curs; > else: > endif; > endif; > > The problem is that I don't really see what the use of the ora_bind is > here. Is there anything that would forbid the port to: > > mysql_query("insert into usercomments values( $param_key, $param_ser, > ..., $param_ref)"); > > Or am I missing something substantial here? > > > Thanks a lot, > > Christian > -- > Christian Schneider <schneider@rrz.uni-koeln.de> > > Zentrum für Angewandte Informatik --.. .- .. -.- > Universitätsweiter Service .-. .-. --.. -.- > > + Universität zu Köln + Robert-Koch-Str. 10 + D-50931 Köln > + Tel. +49 221 478 7021 + >

« previous php.db (#18157) next »