Re: [PHP-DB] help newbie
Return Receipt Your Re: [PHP-DB] help newbie document : was Roy A Jones/IT/GSK received by: at: 12/08/2003 10:45:11 AM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Query Case In-sensitive
As an Oracle DBA (9+ years, versions 7.x - 9.x) I just wanted to make a correction. The LIKE command uses wild card characters ( _ and % ) for substitutions. Oracle IS a case-sensitive RDBMS and the LIKE command will NOT do case-insensitive queries. Roy A. Jones US Pharma Database Administration GlaxoSmithKline Inc. US Pharma IT, Shared Services External: (919) 483-0266 Internal: 703-0266 Fax: (919) 315-6842 Office: RC2 - 2005 Email: [EMAIL PROTECTED] http://usphdba.gsk.com/ - USPHARMA Database Site mustafa ocak [EMAIL PROTECTED] 19-Nov-2003 07:11 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Query Case In-sensitive Use LIKE clause instead of = SELECT item_number FROM item WHERE item_code LIKE 'M1234' ; This will perform case-insensitive matching on all databases I used before (Including Oracle, MySQL, SQL-Server) - Original Message - From: ramki [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 5:46 AM Subject: Re: [PHP-DB] Query Case In-sensitive Generally in DBs, data is case sensitive. Simply you can do an uppercase or lowercase conversion in both sides. Ex : Select item number from item where upper(item_code) = upper(m1234); -ramki - Original Message - From: Larry Sandwick [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 1:23 AM Subject: [PHP-DB] Query Case In-sensitive Is there a way to run a query so that it ignores the case, and the query is not case sensitive? The data being stored is m1234 Query Select item number from item where item_code = M1234 ; The query above should return the data above. TIA Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592 -- 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] Query Case In-sensitive
In Oracle you have a couple of choices. (1) If you can ensure that the data stored is in one case you can apply a function to the keyed in data SELECT item_number FROM item WHERE item_code = lower('M1234'); (2) If you can not ensure data case then you can apply the function to both side SELECT item_number FROM item WHERE lower(item_code) = lower('M1234'); You can use triggers on your tables to do case conversions then ensure case in the table. In later versions of Oracle you can apply function-based indexes to your table to speed up these queries. Roy A. Jones US Pharma Database Administration GlaxoSmithKline Inc. US Pharma IT, Shared Services External: (919) 483-0266 Internal: 703-0266 Fax: (919) 315-6842 Office: RC2 - 2005 Email: [EMAIL PROTECTED] http://usphdba.gsk.com/ - USPHARMA Database Site Larry Sandwick [EMAIL PROTECTED] 17-Nov-2003 14:53 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Subject [PHP-DB] Query Case In-sensitive Is there a way to run a query so that it ignores the case, and the query is not case sensitive? The data being stored is m1234 Query Select item number from item where item_code = M1234 ; The query above should return the data above. TIA Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592
Re: [PHP-DB] Re: Connect to Oracle DB
I just wanted to add my two cents ... I have compiled php with BOTH --with-oracle and --with-oci8. It is usually preferred to have your architectures/systems separate to prevent some performance issues. As a test/demo system then having them on the same box is perfectly acceptable and removes some of the setup issues. The standard oracle (--with-oracle) extension provides basic oracle connectivity for versions 7, 8, and 9. The oci8 (--with-oci8) allows for Oracle 8i (and up) specific functions (LOBs and others). Just a note ... watch what versions of the Oracle client that you install. From my experience the Oracle 9i client can NOT connect to a pre-Oracle 8.0 database. I am connecting to 100+ different Oracle instances from 7.3.x to 9.2.x on many different OS (Solaris, HP, Linux, Windows). My php server is Red Hat Linux 7.2 with Apache. Roy A. Jones Oracle DBA Email: [EMAIL PROTECTED] USPHARMA Database Site Philippe Saladin [EMAIL PROTECTED] 15-Sep-2003 02:49 To [EMAIL PROTECTED] cc Subject [PHP-DB] Re: Connect to Oracle DB Frederico Madeia [EMAIL PROTECTED] a écrit dans le message news: [EMAIL PROTECTED] ... How i connect one server running PHP(linux) to other server running Oracle(linux) ?? when i tryed to connect with ora_logon, the server return me: Call to undefined function: ora_logon(). 1) the oracle extension is not loaded. You need to compile php with it. BUT, you should use --with-oci8 and not --with-oracle. The oracle extension (ora_logon function and friends) is an old one, it can only connect to an oracle 7 database. With the oci extension (ocilogon function and friends), you can connect an oracle 7, 8 or 9 database (see http://fr.php.net/manual/en/ref.oci8.php) May be http://www.enderunix.org/documents/eng/php_oracle_en.html could help you too. 2) php compiled with oci extension is not enough. You need the oracle client. Unfortunately, for Linux, you can't download it alone. You need to download the entire oracle database : see http://otn.oracle.com/software/content.html or ask your DBA : he should be able to give you this oracle client for linux. In php.net describe some functions to connect to oracle,. but how i make to do work ??? I must install oracle on same server that runing php ?? no, you can have two servers. Tanks. Regards, Philippe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP Oracle connection across page.
Here is how I do it ... [REF PHP PAGE] ?php $conn=include(conn.php); ? . HTMl CODE HERE . ?php $qry=SELECT lower(instance) instance FROM all_databases ORDER BY instance; $cursor=ora_open($conn); ora_parse($cursor,$qry,0); ora_exec($cursor); while(ora_fetch($cursor)){ $instance=ora_getcolumn($cursor,0); echo option value = \index.php?tns=.$instance.\.$instance.\n; } ? . HTMl CODE HERE . [conn.php] ?php if ($conn=ora_logon($username.@.$tns_alias,$password)) { $qry=select to_char(sysdate, 'Month DD, HH:MI AM') \SYSDATE\ from dual; $cursor=ora_open($conn); ora_parse($cursor,$qry,0); ora_exec($cursor); while(ora_fetch($cursor)){ $sysdate=ora_getcolumn($cursor,0); } ora_close($cursor); return $conn; } else { echo Unable to connect to .$_GET[tns]; return -1; }; ? -- Hope that helps ... Roy A. Jones US Pharma Database Administration GlaxoSmithKline Inc. US Pharma IT, Shared Services External: (919) 483-0266 Internal: 703-0266 Fax: (919) 315-6842 Office: RC2 - 2005 Email: [EMAIL PROTECTED] USPHARMA Database Site Muhammed Mamedov [EMAIL PROTECTED] 10-Sep-2003 18:31 To [EMAIL PROTECTED] cc Subject [PHP-DB] Re: PHP Oracle connection across page. eventhough I've never used Oracle with PHP here is my suggestion: create a file that will have your DB connection strings and include it in every PHP file which uses Oracle connection. EXAMPLE: [dbCon.php] file [EMAIL PROTECTED]($o_conn_vars[username], $o_conn_vars[password], $o_conn_vars[db]); [myPhpFile.php] include_once(dbCon.php); //Write youe queries now. -- Muhammed Mamedov Software Engineer YTM.com.tr Syho [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have the following problem, please help me. Many thanks. Script 1: ?php [EMAIL PROTECTED]($o_conn_vars[username], $o_conn_vars[password], $o_conn_vars[db]); //Parse sql statement //Execute sql statement. .. ... require('2.inc'); ? ___ 2.inc: // This script will switch the brower to script2.php html form name=s_form action=script2.php method =POST /html script2.php: ?php My problem is, how to get back the Oracle database connection in this script? Please advise. ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php