Re: [PHP-DB] IN clause
Bryan wrote: If I have a SQL statement using the IN clause, how do I keep the order of the list? Example: SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6)) Try SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6)) ORDER BY 5, 9, 3, 4, 1, 7, 2, 8, 6; No idea if that will work ;) -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IN clause
u can use array put all your data into array.. example below while($tmp=mysql_fetch_array($res)){ $myData[$tmp[0]]=$tmp[1]; } ksort($myData); foreach($myData as $nm=>$val){ //put your script here.. } - Original Message - From: "Bryan" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 26, 2007 8:01 PM Subject: [PHP-DB] IN clause > If I have a SQL statement using the IN clause, how do I keep the order > of the list? > > Example: > SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6)) > > How would I pull records in the order of the numbers to list out as: > 5 - Record 5 > 9 - Record 9 > 3 - Record 3 > 4 - Record 4 > 1 - Record 1 > 7 - Record 7 > 2 - Record 2 > 8 - Record 8 > 6 - Record 6 > > Thanks so much... > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Error
putenv() never works well with oracle vars. They need to be set for the account running the web server. When the web server starts, it will inherit the oracle vars from the environment. David Skyers wrote: > Hi > > I have tried adding the following line to my php page. This causes the > php page to fail. > > putenv("NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1"); > > I have tried adding > > $oci=oci_pconnect($user, $pass, $db,'WE8ISO8859P1'); > > I don't believe the error is due to character sets. I believe it is a > problem with binding parameter to oracle procedures in php. > If I remove the binding the procedure works. If I add it it fails. > > Any ideas > > David > > -Original Message- > From: Roberto Mansfield [mailto:[EMAIL PROTECTED] > Sent: 26 June 2007 16:09 > To: php-db@lists.php.net > Subject: [PHP-DB] Re: Error > > This could be a problem with your ORACLE_HOME and/or NLS_LANG > environment variables. These need to be set for your user account > running the web server BEFORE the web server is started. Don't try to > set these in your php script or you'll get strange results. > > David Skyers wrote: >> Hi >> >> I have a page that inserts data into a oracle table using a oracle >> stored procedure via php. However when the php runs I get the >> following >> error: >> >> Warning: oci_execute() [function.oci-execute]: ORA-06550: line 2, >> column >> 7: PLS-00553: character set name is not recognized ORA-06550: line 0, >> column 0: PL/SQL: Compilation unit analysis terminated in >> /nfs/rcs/www/webdocs/research/rsr/staff/dev/rae-mypubs1.php on line >> 121 >> >> Does anyone know why this is occurring? >> >> Regards >> >> David >> >> > > -- > PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Error
Hi I have tried adding the following line to my php page. This causes the php page to fail. putenv("NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1"); I have tried adding $oci=oci_pconnect($user, $pass, $db,'WE8ISO8859P1'); I don't believe the error is due to character sets. I believe it is a problem with binding parameter to oracle procedures in php. If I remove the binding the procedure works. If I add it it fails. Any ideas David -Original Message- From: Roberto Mansfield [mailto:[EMAIL PROTECTED] Sent: 26 June 2007 16:09 To: php-db@lists.php.net Subject: [PHP-DB] Re: Error This could be a problem with your ORACLE_HOME and/or NLS_LANG environment variables. These need to be set for your user account running the web server BEFORE the web server is started. Don't try to set these in your php script or you'll get strange results. David Skyers wrote: > Hi > > I have a page that inserts data into a oracle table using a oracle > stored procedure via php. However when the php runs I get the > following > error: > > Warning: oci_execute() [function.oci-execute]: ORA-06550: line 2, > column > 7: PLS-00553: character set name is not recognized ORA-06550: line 0, > column 0: PL/SQL: Compilation unit analysis terminated in > /nfs/rcs/www/webdocs/research/rsr/staff/dev/rae-mypubs1.php on line > 121 > > Does anyone know why this is occurring? > > Regards > > David > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Error
This could be a problem with your ORACLE_HOME and/or NLS_LANG environment variables. These need to be set for your user account running the web server BEFORE the web server is started. Don't try to set these in your php script or you'll get strange results. David Skyers wrote: > Hi > > I have a page that inserts data into a oracle table using a oracle > stored procedure via php. However when the php runs I get the following > error: > > Warning: oci_execute() [function.oci-execute]: ORA-06550: line 2, column > 7: PLS-00553: character set name is not recognized ORA-06550: line 0, > column 0: PL/SQL: Compilation unit analysis terminated in > /nfs/rcs/www/webdocs/research/rsr/staff/dev/rae-mypubs1.php on line 121 > > Does anyone know why this is occurring? > > Regards > > David > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: IN clause
Thanks to Benno Rem for pointing out the ORDER BY FIELD(..) that one can use in MySQL. Now to find a way to use it in MSSQL 2000. Wrong group for that I guess. 8-O Bryan wrote: By the way, I want the numbers to list out in the order I have them in the statement, not numerically and not randomly like it does now. Thanks... Bryan wrote: If I have a SQL statement using the IN clause, how do I keep the order of the list? Example: SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6)) How would I pull records in the order of the numbers to list out as: 5 - Record 5 9 - Record 9 3 - Record 3 4 - Record 4 1 - Record 1 7 - Record 7 2 - Record 2 8 - Record 8 6 - Record 6 Thanks so much... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: IN clause
By the way, I want the numbers to list out in the order I have them in the statement, not numerically and not randomly like it does now. Thanks... Bryan wrote: If I have a SQL statement using the IN clause, how do I keep the order of the list? Example: SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6)) How would I pull records in the order of the numbers to list out as: 5 - Record 5 9 - Record 9 3 - Record 3 4 - Record 4 1 - Record 1 7 - Record 7 2 - Record 2 8 - Record 8 6 - Record 6 Thanks so much... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IN clause
If I have a SQL statement using the IN clause, how do I keep the order of the list? Example: SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6)) How would I pull records in the order of the numbers to list out as: 5 - Record 5 9 - Record 9 3 - Record 3 4 - Record 4 1 - Record 1 7 - Record 7 2 - Record 2 8 - Record 8 6 - Record 6 Thanks so much... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Error
Hi I have a page that inserts data into a oracle table using a oracle stored procedure via php. However when the php runs I get the following error: Warning: oci_execute() [function.oci-execute]: ORA-06550: line 2, column 7: PLS-00553: character set name is not recognized ORA-06550: line 0, column 0: PL/SQL: Compilation unit analysis terminated in /nfs/rcs/www/webdocs/research/rsr/staff/dev/rae-mypubs1.php on line 121 Does anyone know why this is occurring? Regards David