[PHP-DB] Re: searching through a string

2006-09-18 Thread Kae Verens

Ron Piggott (PHP) wrote:

If $file_name includes the path
/path/to/file/file_name.pdf
is there anyway of searching from the right hand side to the left and
getting the file name out the $file_name variable?  The file name starts
the character following the last /


this should do it.
$filename=preg_replace('/.*\//','',$filename);

Kae

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] ViewSonic VX724

2006-09-18 Thread Ron Piggott (PHP)
I realized this is off topic; I am not sure where I would look online.  

Today I purchased a VX724 LCD monitor for my computer.  I am running
Fedora Core (Linux).  I am not sure where I would find a driver for my
monitor.  ViewSonic's tech support told me they don't support the
monitor directly and I would need to build my own driver.  I am
wondering if this has already been done.  The monitor does work on my
computer, but the color scheme is off.  If someone could help send me in
the right direction I would appreciate it.  

Ron


RE: FW: [PHP-DB] How to install PHP-DEV package for PDO_OCI

2006-09-18 Thread Choy, Wai Yew
Dear all,

Not sure can someone shed some light on my problem...

Thanks..


-Original Message-
From: Choy, Wai Yew [mailto:[EMAIL PROTECTED] 
Sent: Monday, 18 September 2006 9:05 AM
To: Tom Atkinson; php-db@lists.php.net
Subject: RE: FW: [PHP-DB] How to install PHP-DEV package for PDO_OCI

Hi Tom,

Thanks...I tried this...But the php-devel.i386 is for PHP version
5.1.4-1 yum will tried install all the other dependencies (eg. php
5.1.4; httpd 2.0.5..etc). I'm afraid with this dependencies installed,
it will mess up my current config...

Is there a php-devel packet for my setup? (PHP 5.1.6; Apache 2.2)...

Thanks..


-Original Message-
From: Tom Atkinson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, 16 September 2006 10:37 PM
To: php-db@lists.php.net
Subject: Re: FW: [PHP-DB] How to install PHP-DEV package for PDO_OCI

It's in php-devel.

To find out what package something is in you can ask yum

# yum provides phpize

and it will tell you

php-devel.i386   5.1.4-1updates
Matched from:
/usr/bin/phpize
/usr/lib/php/build/phpize.m4


Choy, Wai Yew wrote:
 Hi,
 
 Any kind soul out there can advise me? 
 
 I've also try yum install php5-dev and yum install php-dev...All
not valid..
 
 Thanks.
 
 
 
 -Original Message-
 From: Choy, Wai Yew [mailto:[EMAIL PROTECTED]
 Sent: Fri 9/15/2006 10:25 AM
 To: php-db@lists.php.net
 Subject: [PHP-DB] How to install PHP-DEV package for PDO_OCI
  
 Hi guru,
 
  
 
 Hope some kind souls out there can help me out here...I've
successfully
 compile Apache2.2; PHP 5.16 on a Fedora 4 (with the Oracle instant
 client) machine...My connection to the remote Oracle database is
working
 fine using OCI_CONNECT.
 
  
 
 My next step is to try out PDO. When I do a php -m, I didn't see the
 PDO_OCI module. Hence I downloaded the PDO_OCI-1.0.tgz file and do a
 pear install.
 
  
 
 But it comes out an error ERROR: `phpize' failed. Then I found out
 that phpize error is because the PHP-DEV package is not install. The
 problem puzzle me is how do I install PHP5-DEV into my current setup??
 
  
 
 I do a Google and can't find any PHP5-DEV package for Fedora4
 PHP5.1.6...
 
  
 
 Any help will be greatly appreciated here...
 
  
 
 Below is some of the output from my machine:
 
  
 
 [EMAIL PROTECTED] dbtest]# pear install PDO_OCI-1.0.tgz
 
 7 source files, building
 
 running: phpize
 
 Configuring for:
 
 PHP Api Version: 20041225
 
 Zend Module Api No:  20050922
 
 Zend Extension Api No:   220051025
 
 ERROR: `phpize' failed
 
  
 
  
 
  
 
 [EMAIL PROTECTED] dbtest]# php -v
 
 PHP 5.1.6 (cli) (built: Sep 14 2006 12:23:31)
 
 Copyright (c) 1997-2006 The PHP Group
 
 Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
 
  
 
  
 
 [EMAIL PROTECTED] dbtest]# php -m
 
 [PHP Modules]
 
 ctype
 
 date
 
 dom
 
 hash
 
 iconv
 
 libxml
 
 oci8
 
 pcre
 
 PDO
 
 posix
 
 Reflection
 
 session
 
 SimpleXML
 
 SPL
 
 SQLite
 
 standard
 
 tokenizer
 
 xml
 
 xmlreader
 
 xmlwriter
 
 zlib
 
  
 
 [Zend Modules]
 
  
 
  
 
 Thanks a million in advance...
 
 Choy

-- 
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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] local queries vs remote queries

2006-09-18 Thread Chris

Stuart Kendrick wrote:

hi,

i'm looking for trouble-shooting pointers, particularly around how to
debug query results

on one host, i have a PHP reporting tool querying a PostGres back-end.
Recently (i must have changed something ... but ... i don't remember
even logging into this box recently, let alone changing anything),
reports starting returning zero rows

however, when i point the reporting front-end at another back-end host
(the development box), the reports contain results.  the results even
look correct ;)

when i run 'psql' on the production box and manually enter SELECT
statements, i see results.  those results look awfully similar to the
results i see when i point my reporting front-end at the development box
back-end ;)


here's a window into my code:

[...]
  echo p$sql/p;

  # Query Soma
  $dbh = connect_db();
  $q   = query_db($dbh, $sql, $place);

  # Find metadata
  $num_hosts = $q-numRows();
  DB::isError($q) and die ($q-getMessage());
  echo p# of Records = $num_hosts/p;

  # Generate and print the table
  generate_table($q);
[...]

function connect_db () {
  $dsn = 'pgsql://foo:[EMAIL PROTECTED]/soma';
  $dbh = DB::connect($dsn, array('debug' = 1));
  DB::isError($dbh) and die ($dbh-getMessage());
  return $dbh;
}

function query_db ($dbh, $sql, $place) {
  $q = $dbh-query($sql, $place);
  DB::isError($q) and die ($q-getMessage());
  return $q;
}
[...]


when i perform a manual query via psql, i get results:

soma=# SELECT mac, ip_addr, vlan, ad_ou, current_os_user, os_hostname,
dns_hostname, version_name, snmp_sys_descr, snmp_sys_objectid,
first_seen, last_seen, last_updated FROM hosts LEFT JOIN os_versions ON
hosts.osver = os_versions.versionid WHERE last_seen  2006-08-14 AND
vlan = 74 ORDER BY ip_addr ASC;
[...results...]

but when i run a query using my PHP front-end, i don't. the debug output
(echo stmts) to my browser looks like this:

Querying Soma for Vlan = 74 WHERE Last_seen  2006-08-14

SELECT mac, ip_addr, vlan, ad_ou, current_os_user, os_hostname,
dns_hostname, version_name, snmp_sys_descr, snmp_sys_objectid,
first_seen, last_seen, last_updated FROM hosts LEFT JOIN os_versions ON
hosts.osver = os_versions.versionid WHERE last_seen  ? AND vlan = ?
ORDER BY ip_addr ASC

# of Records = 0

Zero records.  No output.  As though the database were empty.  i've run
a bunch of queries ... my reporting front-end allows me to produce a
dozen or so reports ... and they all return 0 records



ok, so i enabled postgres' statement logging capability in postgresql.conf:
[...]
log_statement = 'all'
[...]

here's what i see when i perform a manual 'psql' query:


Sep 13 10:29:09 starsha postgres[24143]: [2-1] LOG:  connection
received: host=[local]
Sep 13 10:29:09 starsha postgres[24143]: [3-1] LOG:  connection
authorized: user=foo database=soma
Sep 13 10:29:31 starsha postgres[24143]: [4-1] LOG:  statement: SELECT
mac, ip_addr, vlan, ad_ou, current_os_user, os_hostname, dns_hostname,
version_name, snmp_sys_descr,
Sep 13 10:29:31 starsha postgres[24143]: [4-2]  snmp_sys_objectid,
first_seen, last_seen, last_updated FROM hosts LEFT JOIN os_versions ON
hosts.osver = os_versions.versionid
Sep 13 10:29:31 starsha postgres[24143]: [4-3]  WHERE last_seen 
2006-08-14 AND vlan = 74 ORDER BY ip_addr ASC;
Sep 13 10:29:32 starsha postgres[24143]: [5-1] LOG:  duration: 93.679 ms
Sep 13 10:29:53 starsha postgres[24143]: [6-1] LOG:  disconnection:
session time: 0:00:43.95 user=foo database=soma host=[local]


and here's what i see when my PHP code performs the query:

Sep 13 10:24:26 starsha postgres[24115]: [2-1] LOG:  connection
received: host=starsha.fhcrc.org port=50184
Sep 13 10:24:26 starsha postgres[24115]: [3-1] LOG:  connection
authorized: user=foo database=soma
Sep 13 10:24:26 starsha postgres[24115]: [4-1] LOG:  statement: SELECT
mac, ip_addr, vlan, ad_ou, current_os_user, os_hostname, ^M
Sep 13 10:24:26 starsha postgres[24115]: [4-2]
dns_hostname, version_name, snmp_sys_descr, ^M
Sep 13 10:24:26 starsha postgres[24115]: [4-3]
snmp_sys_objectid, first_seen, last_seen, last_updated FROM hosts LEFT
JOIN os_versions ON hosts.osver =
Sep 13 10:24:26 starsha postgres[24115]: [4-4]  os_versions.versionid
WHERE last_seen  '2006-08-14' AND vlan = '74' ORDER BY ip_addr ASC
Sep 13 10:24:26 starsha postgres[24115]: [5-1] LOG:  duration: 34.641 ms
Sep 13 10:24:26 starsha postgres[24115]: [6-1] LOG:  disconnection:
session time: 0:00:00.10 user=foo database=soma
host=production.company.com port=50184


those '^M' look suspicious ... and so do the single quotes around
2006-08-14 and 74 ... when i try typing single quotes into a manual psql
query, i get nothing in response.  could this be a symptom of the problem?


^M's are newlines, nothing to worry about.

So if you do the same query with  without the quotes it behaves 
differently?


SELECT mac, ip_addr, vlan, ad_ou, current_os_user, os_hostname,
dns_hostname, version_name, snmp_sys_descr, snmp_sys_objectid,
first_seen, last_seen, last_updated FROM 

Re: FW: [PHP-DB] How to install PHP-DEV package for PDO_OCI

2006-09-18 Thread Chris

Choy, Wai Yew wrote:

Dear all,

Not sure can someone shed some light on my problem...

Thanks..


-Original Message-
From: Choy, Wai Yew [mailto:[EMAIL PROTECTED] 
Sent: Monday, 18 September 2006 9:05 AM

To: Tom Atkinson; php-db@lists.php.net
Subject: RE: FW: [PHP-DB] How to install PHP-DEV package for PDO_OCI

Hi Tom,

Thanks...I tried this...But the php-devel.i386 is for PHP version
5.1.4-1 yum will tried install all the other dependencies (eg. php
5.1.4; httpd 2.0.5..etc). I'm afraid with this dependencies installed,
it will mess up my current config...

Is there a php-devel packet for my setup? (PHP 5.1.6; Apache 2.2)...


Where did you get those other packages from? Try that location.

--
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] Call Function On Session Destroy

2006-09-18 Thread Chris

Manoj Singh wrote:

Hi Guys,

I have a question.

Is it possible to call any function when the session expires in PHP? I want
to do some database deletions whenever the session expires.


You need to set your own session handlers:

http://php.net/session_set_save_handler

Then you can do whatever you like (for example 
http://www.zend.com/codex.php?id=1126single=1)


--
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: FW: [PHP-DB] How to install PHP-DEV package for PDO_OCI

2006-09-18 Thread Chris

Choy, Wai Yew wrote:

I get PHP 5.16 from the php.net site...Can't find a php-devel for
5.1.6

http://www.php.net/downloads.php


Where did you get the RPM's from?

php.net does NOT give you rpm's.

--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php