[PHP-DB] Re: PHP4 & LDAP

2002-03-20 Thread David Christensen

Just in case anyone was wondering, here's a bit more info.  I'm not sure 
why some attributes show up the other way though:


\n";
ldap_close($linkID);

?>

Now (for some reason I haven't figured out yet) if you don't do the 
ldap_first_entry() step, you cannot access all of the attribute values 
returned from the $search!

You can test by commenting it out and changing the $values line to use 
the $search value as the second arg.

I hope that helps someone.  I could have used it for sure.



David Christensen wrote:

> Not sure if this is the right list for this, but I didn't see any others 
> on the PHP web site that made sense...
> 
> I'm using the following packages:
> 
> php-common-4.1.2-1mdk
> php-4.1.2-1mdk
> mod_php-4.1.2-1mdk
> php-ldap-4.1.2-1mdk
> openldap-clients-2.0.21-1.1mdk
> openldap-servers-2.0.21-1.1mdk
> openldap-2.0.21-1.1mdk
> libldap2-2.0.21-1.1mdk
> php-ldap-4.1.2-1mdk
> apache-modules-1.3.23-4mdk
> apache-common-1.3.23-4mdk
> apache-conf-1.3.23-3mdk
> apache-1.3.23-4mdk
> 
> 
> I'm trying to use my LDAP server for privilege access to certain 
> portions of the site.  I'm verifying the user's account information via 
> LDAP and that seems to work ok, because I can bind and do a modify on 
> the user's information.  I'm updating a particular field to hold the 
> sessionID and a time stamp.  The record updates just fine, because I can 
> do a "ldapsearch" from the command line on the server using the same 
> credentials I use in PHP and I can see the update.
> 
> I also have the server WIDE OPEN at the moment to test.  I didn't want 
> any stray ACL's to get in the way of debugging this.
> 
> The problem arises when I try to read back all of the attributes within 
> the PHP script.  I can see only certain attributes: uid, mail, cn (the 
> normal stuff) but if I try to read these fields that I want to use for 
> the session, they don't print in PHP, but the show up from the LDAP 
> command line util.  The fields include: employeeNumber, carLicense, 
> departmentNumber.
> 
> Like I said earlier, I can update them from PHP, just can't read them back.
> 
> Any ideas are greatly appreciated!
> 
> David Christensen
> 



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




RE: [PHP-DB] elseif statement syntax

2002-03-20 Thread Andrea Caldwell

Thanks for responding Steve,

My error reporting is turned on, because I always get errors.  I found the
problem, I had two ;; at the end of one of the statements.

Thanks- Andrea

-Original Message-
From: Steve Cayford [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 10:27 AM
To: Andrea Caldwell
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] elseif statement syntax


You probably have error reporting turned off in your php.ini file or you
may be directing errors into your log file, try checking there.

Why are you tacking "or die(mysql_error())" on the end of each of your
query assignments? You're just assigning a string to a variable so
there's nothing to fail, or at least no mysql errors.

-Steve


On Wednesday, March 20, 2002, at 10:41  AM, Andrea Caldwell wrote:

> Hi All,   I'm pretty new at this, so go easy on me please ;-)
>
> What is wrong w/ this syntax?  If the search results are 0, it just
> displays
> a blank screen instead of echoing the error message if numresults ==0
> or the
> mysql_error message.  If data is found, everything is fine.  Thanks in
> advance for your help!
>
> if($searchterm){
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory
> where
> realname like '%".$searchterm."%'" or die (mysql_error());
> }
> elseif($location){
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory
> where
> location like '%".$location."%'" or die (mysql_error());
> }
> else{
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory
> where
> location like '%".$searchloc."%'" or die (mysql_error());
> }
>
> $result = mysql_query($query) or die (mysql_error());
> $num_results = mysql_num_rows($result)or die (mysql_error());;
>
>  if($num_results==0){
>  echo "Sorry, nothing matched your search request.  Please go back and
> try
> again.";
>  }
>
>  else {
>  echo "Number of Entries Found:
> ".$num_results."";
>  }
>
>
>
> --
> 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-DB] PHP Linux performance vs. PHP Windows XP performance

2002-03-20 Thread David Yee

Hi all.  Anyone have experience/comments on the general performance of PHP
(and perhaps MySQL) on Linux (e.g. RH 7.2) compared to that of Windows XP
using the same hardware?  Thanks.

David




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




[PHP-DB] PHP4 & LDAP

2002-03-20 Thread David Christensen

Not sure if this is the right list for this, but I didn't see any others 
on the PHP web site that made sense...

I'm using the following packages:

php-common-4.1.2-1mdk
php-4.1.2-1mdk
mod_php-4.1.2-1mdk
php-ldap-4.1.2-1mdk
openldap-clients-2.0.21-1.1mdk
openldap-servers-2.0.21-1.1mdk
openldap-2.0.21-1.1mdk
libldap2-2.0.21-1.1mdk
php-ldap-4.1.2-1mdk
apache-modules-1.3.23-4mdk
apache-common-1.3.23-4mdk
apache-conf-1.3.23-3mdk
apache-1.3.23-4mdk


I'm trying to use my LDAP server for privilege access to certain 
portions of the site.  I'm verifying the user's account information via 
LDAP and that seems to work ok, because I can bind and do a modify on 
the user's information.  I'm updating a particular field to hold the 
sessionID and a time stamp.  The record updates just fine, because I can 
do a "ldapsearch" from the command line on the server using the same 
credentials I use in PHP and I can see the update.

I also have the server WIDE OPEN at the moment to test.  I didn't want 
any stray ACL's to get in the way of debugging this.

The problem arises when I try to read back all of the attributes within 
the PHP script.  I can see only certain attributes: uid, mail, cn (the 
normal stuff) but if I try to read these fields that I want to use for 
the session, they don't print in PHP, but the show up from the LDAP 
command line util.  The fields include: employeeNumber, carLicense, 
departmentNumber.

Like I said earlier, I can update them from PHP, just can't read them back.

Any ideas are greatly appreciated!

David Christensen


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




Re: [PHP-DB] elseif statement syntax

2002-03-20 Thread Steve Cayford

You probably have error reporting turned off in your php.ini file or you 
may be directing errors into your log file, try checking there.

Why are you tacking "or die(mysql_error())" on the end of each of your 
query assignments? You're just assigning a string to a variable so 
there's nothing to fail, or at least no mysql errors.

-Steve


On Wednesday, March 20, 2002, at 10:41  AM, Andrea Caldwell wrote:

> Hi All,   I'm pretty new at this, so go easy on me please ;-)
>
> What is wrong w/ this syntax?  If the search results are 0, it just 
> displays
> a blank screen instead of echoing the error message if numresults ==0 
> or the
> mysql_error message.  If data is found, everything is fine.  Thanks in
> advance for your help!
>
> if($searchterm){
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory 
> where
> realname like '%".$searchterm."%'" or die (mysql_error());
> }
> elseif($location){
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory 
> where
> location like '%".$location."%'" or die (mysql_error());
> }
> else{
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory 
> where
> location like '%".$searchloc."%'" or die (mysql_error());
> }
>
> $result = mysql_query($query) or die (mysql_error());
> $num_results = mysql_num_rows($result)or die (mysql_error());;
>
>  if($num_results==0){
>  echo "Sorry, nothing matched your search request.  Please go back and 
> try
> again.";
>  }
>
>  else {
>  echo "Number of Entries Found:
> ".$num_results."";
>  }
>
>
>
> --
> 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-DB] elseif statement syntax

2002-03-20 Thread Andrea Caldwell

Hi All,   I'm pretty new at this, so go easy on me please ;-)

What is wrong w/ this syntax?  If the search results are 0, it just displays
a blank screen instead of echoing the error message if numresults ==0 or the
mysql_error message.  If data is found, everything is fine.  Thanks in
advance for your help!

if($searchterm){
$query = "select directory.realname, directory.phone, directory.ext,
directory.phone2, directory.email, directory.location from directory where
realname like '%".$searchterm."%'" or die (mysql_error());
}
elseif($location){
$query = "select directory.realname, directory.phone, directory.ext,
directory.phone2, directory.email, directory.location from directory where
location like '%".$location."%'" or die (mysql_error());
}
else{
$query = "select directory.realname, directory.phone, directory.ext,
directory.phone2, directory.email, directory.location from directory where
location like '%".$searchloc."%'" or die (mysql_error());
}

$result = mysql_query($query) or die (mysql_error());
$num_results = mysql_num_rows($result)or die (mysql_error());;

 if($num_results==0){
 echo "Sorry, nothing matched your search request.  Please go back and try
again.";
 }

 else {
 echo "Number of Entries Found:
".$num_results."";
 }



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




[PHP-DB] Re: oracle-mysql

2002-03-20 Thread Philippe Saladin

How many tables ? do you have the script that generated the oracle tables
and their relationships ? what about the triggers, views, foreign keys, ...
Are theses functionalities exist on MySQL (I don't know MySQL) ?
You could have a look at Chyfo (http://www.ispirer.com/products/). Chyfo can
export data from any database accessible through the ODBC interface. It
exports data into text files (CSV, TAB delimited, fixed length, SQL INSERT
statements and XML are supported formats), generates native DDL (Data
Definition Language) and import/load scripts for various databases.
See also Genio (http://www.hummingbird.com/products/dirs/genio/index.html),
and http://www.quest.com/schema_manager/index.asp

Regards,
Philippe



"Pedro M. S. Oliveira" <[EMAIL PROTECTED]> a écrit dans le message
news: 006c01c1d009$6fd83d10$[EMAIL PROTECTED]
> hi all, i need to migrate an oracle database (+-1gb) to a mysql one, but i
> don't have a clue how to do this.
> i'm thinking in dumping the whole content of the oracle database to a txt
> file but i don't know if there is a better way
> any ideias on this one.
> btw the oracle machine is running on windows 2000 server and the mysql one
> is running on linux
> i don't have php on either machines but the mysql i'll have a connection
to
> an apache running machine.
> the prob here is... what is the better way to migrate the data?
> thanx
>



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




Re: [PHP-DB] major performance disparities with mysql/php

2002-03-20 Thread Henrique Flach Latorre Moreno

Hank,
i don´t know, but i thing the PHP have a time out for the "PHP process" and 
a time out for the MySQL connection,
cause i a lot of people that don´t like to stay 70 seconds in front of 
computer :)
probably have some way to extend the time out

At 05:30 20/03/02 -0800, you wrote:

>Hello - I'm posted this to the mysql list but got no response.  While it 
>sounds
>like a mysql problem, I'm convinced that it is a PHP problem (see bottom of
>note.)
>
>   I've recently installed mySQL on a RH7.2 box without any problems - it runs
>great.  I've been testing some long running queries (full table scans, etc)
>under different scenarios, and get wildy differing results.   Between each 
>test
>case, I was flushing all tables and re-starting the mysql deamon.  When I run
>one of my longest queries in the mysql command line client, it runs in 
>about 77
>seconds.
>
>When I run the identical query via a simple PHP script running on the box, the
>same query takes about 930 seconds to complete.  For the life of me, I can 
>not
>figure out why the identical query would run differently from the command 
>line
>than from PHP.  I've repeated this test about 10 times just to be sure - 
>and it
>
>is entirely repeatable: command line - about a minute - PHP - about 16 times
>longer.  Any ideas or suggestions?
>
>  I'm running RH 7.2 (2.4.9-21) on a Dell Poweredge 2550, 1GB memory, 
> RAID, with
>mysql version 3.23.41 (the standard install unchanged from the RH 
>media).  Here
>is the query...pretty simple:
>
> insert into summary_table
>select frb, denom, series,
>count(*) as cnt,
>sum(bills) as bills,
>sum(bills_hit) as bills_hit,
>sum(total_hits) as total_hits
>from detail_table
>
>If it a memory/cpu resource problem, how do I set RH to give PHP and 
>Apache the
>same priority as the mysql deamon?
>
>I've also written a small Perl script to execute the same queries, and that
>runs in 70 seconds (same as mysql client), so there must be some
>memory/processor limitation placed on PHP that prevents it from running as
>quickly as these other methods.  Any ideas/suggestions?
>
>Many thanks in advance..
>
>  -Hank
>
>__
>Do You Yahoo!?
>Yahoo! Sports - live college hoops coverage
>http://sports.yahoo.com/
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

Henrique Flach Latorre Moreno
Smart Tech Consulting
www.smartech.com.br
Av. Rio Branco 181, 1005
Centro - Rio de Janeiro - RJ
Tels : (21) 2532-6335


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




[PHP-DB] Copy distinct results to new table solved

2002-03-20 Thread Chris Payne

Hi there everyone,

Just to let you all know I solved the problem I was having earlier - it's probably not 
the most elegant solution but hey, it works and it's very fast so I can't complain :-)

Thanks to everyone in this group for your help on everything i've asked in the past 
(And will probably ask in the future :-)

Chris



Re: [PHP-DB] order by problem

2002-03-20 Thread [EMAIL PROTECTED]

On Wed, 20 Mar 2002 [EMAIL PROTECTED] wrote:

You have your ctrlnumber field defined as varchar. If you define
ctrlnumber as number, you could also use

SELECT max(ctrlnumber) FROM table WHERE id=14;

Cheers
Urosh

> Hello All,
>
> I´m having a 'problem' that I dont know how to resolve. The problem is:
>
> I have a table that I want to get the last number to increment. To do this I
> want to sort the filed 'ctrlnumber'. Using this query´s I get:
> mysql> SELECT ctrlnumber FROM table WHERE id=14;
> ++
> | ctrlnumber |
> ++
> | 7  |
> | 1  |
> | 2  |
> | 3  |
> | 4  |
> | 5  |
> | 6  |
> | 8  |
> | 9  |
> | 10 |
> | 11 |
> ++
> 11 rows in set (0.00 sec)
>
> mysql> SELECT ctrlnumber FROM table WHERE id=14 order by ctrlnumber;
> ++
> | ctrlnumber |
> ++
> | 1  |
> | 10 |
> | 11 |
> | 2  |
> | 3  |
> | 4  |
> | 5  |
> | 6  |
> | 7  |
> | 8  |
> | 9  |
> ++
> 11 rows in set (0.01 sec)
>
>
> When I try to sort, it doesn´t return to me in the order that I need (1 2 3
> 4 5 6 7 8 9 10 11). Is there a way to do this or I´ll have to include 01 02
> 03 04 05 to all my recoreds ?
>
> Thank´s in advance,
> Gus
>
>
>


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




Re: [PHP-DB] order by problem

2002-03-20 Thread cal

Make CtrlNumber a numeric value instead of a string.
=C=
*
* Cal Evans
* Techno-Mage
* http://www.calevans.com
*

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 20, 2002 7:21 AM
Subject: [PHP-DB] order by problem


> Hello All,
>
> I´m having a 'problem' that I dont know how to resolve. The problem is:
>
> I have a table that I want to get the last number to increment. To do this
I
> want to sort the filed 'ctrlnumber'. Using this query´s I get:
> mysql> SELECT ctrlnumber FROM table WHERE id=14;
> ++
> | ctrlnumber |
> ++
> | 7  |
> | 1  |
> | 2  |
> | 3  |
> | 4  |
> | 5  |
> | 6  |
> | 8  |
> | 9  |
> | 10 |
> | 11 |
> ++
> 11 rows in set (0.00 sec)
>
> mysql> SELECT ctrlnumber FROM table WHERE id=14 order by ctrlnumber;
> ++
> | ctrlnumber |
> ++
> | 1  |
> | 10 |
> | 11 |
> | 2  |
> | 3  |
> | 4  |
> | 5  |
> | 6  |
> | 7  |
> | 8  |
> | 9  |
> ++
> 11 rows in set (0.01 sec)
>
>
> When I try to sort, it doesn´t return to me in the order that I need (1 2
3
> 4 5 6 7 8 9 10 11). Is there a way to do this or I´ll have to include 01
02
> 03 04 05 to all my recoreds ?
>
> Thank´s in advance,
> Gus
>
>
> --
> 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-DB] major performance disparities with mysql/php

2002-03-20 Thread Henry Hank


Hello - I'm posted this to the mysql list but got no response.  While it sounds
like a mysql problem, I'm convinced that it is a PHP problem (see bottom of
note.)

  I've recently installed mySQL on a RH7.2 box without any problems - it runs
great.  I've been testing some long running queries (full table scans, etc)
under different scenarios, and get wildy differing results.   Between each test
case, I was flushing all tables and re-starting the mysql deamon.  When I run
one of my longest queries in the mysql command line client, it runs in about 77
seconds. 

When I run the identical query via a simple PHP script running on the box, the
same query takes about 930 seconds to complete.  For the life of me, I can not 
figure out why the identical query would run differently from the command line 
than from PHP.  I've repeated this test about 10 times just to be sure - and it

is entirely repeatable: command line - about a minute - PHP - about 16 times
longer.  Any ideas or suggestions?  

 I'm running RH 7.2 (2.4.9-21) on a Dell Poweredge 2550, 1GB memory, RAID, with
mysql version 3.23.41 (the standard install unchanged from the RH media).  Here
is the query...pretty simple:

insert into summary_table
   select frb, denom, series, 
   count(*) as cnt, 
   sum(bills) as bills, 
   sum(bills_hit) as bills_hit, 
   sum(total_hits) as total_hits 
   from detail_table

If it a memory/cpu resource problem, how do I set RH to give PHP and Apache the
same priority as the mysql deamon?  

I've also written a small Perl script to execute the same queries, and that
runs in 70 seconds (same as mysql client), so there must be some
memory/processor limitation placed on PHP that prevents it from running as
quickly as these other methods.  Any ideas/suggestions?

Many thanks in advance..

 -Hank

__
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

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




[PHP-DB] order by problem

2002-03-20 Thread guslist

Hello All,

I´m having a 'problem' that I dont know how to resolve. The problem is:

I have a table that I want to get the last number to increment. To do this I
want to sort the filed 'ctrlnumber'. Using this query´s I get:
mysql> SELECT ctrlnumber FROM table WHERE id=14;
++
| ctrlnumber |
++
| 7  |
| 1  |
| 2  |
| 3  |
| 4  |
| 5  |
| 6  |
| 8  |
| 9  |
| 10 |
| 11 |
++
11 rows in set (0.00 sec)

mysql> SELECT ctrlnumber FROM table WHERE id=14 order by ctrlnumber;
++
| ctrlnumber |
++
| 1  |
| 10 |
| 11 |
| 2  |
| 3  |
| 4  |
| 5  |
| 6  |
| 7  |
| 8  |
| 9  |
++
11 rows in set (0.01 sec)


When I try to sort, it doesn´t return to me in the order that I need (1 2 3
4 5 6 7 8 9 10 11). Is there a way to do this or I´ll have to include 01 02
03 04 05 to all my recoreds ?

Thank´s in advance,
Gus


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




[PHP-DB] Determine last quarter

2002-03-20 Thread Henry Hank


> If anyone is interested, this is what I finally came up with. I'm not sure
> how graceful it is, but it works ;) 

Here's another method... which can be condensed, but I left it expanded to
demonstrate what was going on.  The trick is finding the first day of the
*next* month, and getting the previous day  (
mktime(0,0,0,$start_month+3,0,$year) ), which is always the last day of the
previous month.

-Hank








__
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

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




[PHP-DB] Copy distinct results to new table

2002-03-20 Thread Chris Payne

Hi there everyone,

How can I copy distinct results of a query to a table in a DB?  I have 3 pulldowns, 
the first one selects the category, then the second one gets the holiday type based on 
the category, and the third one gets from countries where category = category AND 
holiday type = holiday type.  The problem is there is almost 30,000 entries which it 
needs to sort through and it takes a few seconds for each pulldown to be calculated, 
is there a better way than the below 

Basically i'm guessing I can grab the results and then insert them into a seperate 
table so that I only save the unique results and so don't have to sort once i've 
created the new table?

Thanks for your help everyone,

Chris


(For the first pulldown):

  
 
 
  
  

Make a Selection

Selected >>>

".
   $myrow["category"]." "; }?>
  
  
  
  

For the second pulldown:

  
 
  
  

Make a Selection

<<< Selected >>>

".
   $myrow["type"]."  "; }?>
  
  
  
  
  

For the third pulldown:

 
 
  
  

Make a Selection

<<< Selected >>>

".
   $myrow["country"]."  "; }?>
  
  
  
  
  
  



[PHP-DB] oracle-mysql

2002-03-20 Thread Pedro M. S. Oliveira

hi all, i need to migrate an oracle database (+-1gb) to a mysql one, but i
don't have a clue how to do this.
i'm thinking in dumping the whole content of the oracle database to a txt
file but i don't know if there is a better way
any ideias on this one.
btw the oracle machine is running on windows 2000 server and the mysql one
is running on linux
i don't have php on either machines but the mysql i'll have a connection to
an apache running machine.
the prob here is... what is the better way to migrate the data?
thanx


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




RE: [PHP-DB] Determine last quarter

2002-03-20 Thread Rankin, Randy

If anyone is interested, this is what I finally came up with. I'm not sure
how graceful it is, but it works ;) 

";
echo "End of Period: $period_last_day";

?>


-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 19, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Determine last quarter


Hello all,

Does anyone know how I might determine the start date and end date of the
previous calendar quarter based on today's date. For example, today is
2002-03-19, so the previous quarter start date would return 2001-10-01 and
the previous quarter end date would return 2001-12-31. I am trying to
determine these dates for a report that generates previous quarter sales
based on today (whatever 'today' might be). Hope that's clear. 

Thanks in advance,

Randy Rankin