[PHP] Re: multidimensional array sort

2005-03-14 Thread Nadim Attari
Try

http://terra.di.fct.unl.pt/docs/php/function.array-multisort.php.htm

 function array_csort()
 {//coded by Ichier2003
  $args = func_get_args();
  $marray = array_shift($args);
  $msortline = "return(array_multisort(";
  foreach ($args as $arg)
  {
   $i++;
   if (is_string($arg)) foreach ($marray as $row) $sortarr[$i][] =
$row[$arg];
   else $sortarr[$i] = $arg;
   $msortline .= "\$sortarr[".$i."],";
  }

  $msortline .= "\$marray));";
  eval($msortline);
  return $marray;
 }

Regards,
Nadim Attari

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



RE: [PHP] php compiler

2005-03-14 Thread Warren Vail
I could be wrong, but I believe that all the Java apps out there are not
native binary machine code either?  unless you count the JRE (Java Runtime
Environment).  Seems to me that is the way things are today, with JRE's all
having "run time configuration".  I would prefer to PHP to Java any day.

Have you checked out the Road Send compiler?  http://www.roadsend.com/  I
don't believe it produces pure native binary either, but I could be wrong
here as well.

good luck,

Warren Vail

> -Original Message-
> From: Davy Durham [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 14, 2005 9:22 PM
> To: php-general@lists.php.net
> Subject: [PHP] php compiler
>
>
> Sooo.. I'm assuming there's no stable project for compiling php code to
> native binary machine code huh?  (I've done some searching)  Even
> anything commercial? (I didn't care for Zend's optimizer so much.. still
> has *RUN*time configuration)
>
> Thanks,
>   Davy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



[PHP] php compiler

2005-03-14 Thread Davy Durham
Sooo.. I'm assuming there's no stable project for compiling php code to 
native binary machine code huh?  (I've done some searching)  Even 
anything commercial? (I didn't care for Zend's optimizer so much.. still 
has *RUN*time configuration)

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


Re: [PHP] newbie:changing variable to type resource

2005-03-14 Thread Saswat Praharaj
Richard,

Thanks for the quick reply.

Here is what I am trying to do :

I am trying to tunnel some http packets from the browser to a PC which
is inside a private network/firewall.

The PC in the pvt. netwok sends a request to my server at regular interval.
When the browser wants to send some packets to the PC (which it can't
without opening a port in the firewall), it sends the packets to my
program  and my program tunnels those packets in the response to the
request messeges coming from the PC inside the firewall.

I am able to do it when there is only one PC and one browser tries to
access it by storing the socket ID of the browser connection in a
temporary variable in my program ,but I need  some kind of mechanism
to store socket IDs for connections coming from multiple browsers.
Without which I can't distinguish between different connections.

Regards,
-Saswat


On Mon, 14 Mar 2005 09:11:46 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> 
wrote:
> > I am new to PHP, stuck with a problem and need your help.
> >
> > I would like to change a variable to type resource.
> > I searched in php.net and in google but did not find anything helpful.
> >
> > Now , why I would like to do that...
> >
> > I am writing a socket application which will accept connection from
> > browser,receive data and write the data sent by browser into another
> > open socket.Receive data from the open socket and write it back to the
> > browser.
> >
> > When there are more than one client(browser) connecting to my program
> > ,I am saving the connection information (socket ID)for browser
> > connections in a plain text file.
> >
> > I intend to retrive the socket ID information and do a
> > socket_write(..) with socket ID as the first parameter, but I am
> > getting an error that I cant convert any type to a resource type. Is
> > there any workaround ??
> >
> > Is it going to help me if I use session information ?
> >
> > I am not using apache.
> >
> > I may be wrongly designing the program.
>
> The design just maybe might be fine in theory, but in practice...
>
> A socket connection can't be shared across PHP instances, I don't think.
>
> Certainly not by writing the resource into a text file.
>
> You *MIGHT* be able to write the resource into shared memory
> http://php.net/shmop but I doubt that will work at all, and even if it
> does, having two programs reading/writing the same socket resource at one
> time sounds like a recipie for disaster.
>
> Why do you want to share this socket across two PHP programs?
>
> What exactly are you doing?
>
> I suspect that the design is not right, even in theory, but can't be sure.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>

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



Re: [PHP] can't pull products from DB with REGEXP?

2005-03-14 Thread David OBrien
At 04:53 PM 3/14/2005, [EMAIL PROTECTED] wrote:
I have table with products. In column categories are listed numbers of 
categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for the 
moment)
Now, I have to list all products that belongs to category with cat. 
number, e.g. 11.

If I use query:
select * from products where categories like '11, '
product no. 5 will be listed but not product no. 3
select * from products where categories like '%11,% '
will list products 3 and 5 but
select * from products where categories like '%1,% '
will list products 2, 3 and 5 too - and, 3 & 5 are wrong.
I got from friend this solution:
select * from products where categories REGEXP '(^".$cat_num."|, 
".$cat_num.")'
it works just fine if I use 2 digit cat number. e.g. 11 or 26 or 62. But 
if I select for cat. num. 2 it will list all products from categories 2 
and everything between 20 and 29. 32 or 62 will not be listed.

Confusing, ha?
Thanks for any help!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
get the categories in a variable. like

produces
SELECT * FROM products WHERE categories REGEXP '(35|\ 8|\ 72|\ 1|\ 4)'
which matches the correct items in my test data
-Dave
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] odd error

2005-03-14 Thread Stephen Johnson
It's Hebrew -- it means twice colon.
On Mar 14, 2005, at 8:34 PM, Rob Agar wrote:
hey all
just got this error:
Parse error: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM'
The line that caused it was this: $db =& null;  (yes I know it's wrong,
it's a typo/brain spasm)
I'm just curious - what language IS that? finnish?
Rob Agar
Web Site Consultant
Wild Lime Media - [EMAIL PROTECTED]
Studio 1, 70 McLeod Street, Cairns 4870
Tel: 07 4081 6677  |  Fax: 07 4081 6679
Web and Software Development Services  - www.wildlime.com
Search Engine Optimisation Services - search.wildlime.com
Professional Website Hosting Services -www.hostonlime.com.au
Winner 2004 Telstra North QLD Media Awards - Best Website - Online
Content & Information

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

*
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] odd error

2005-03-14 Thread Rob Agar
hey all

just got this error:
Parse error: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM' 

The line that caused it was this: $db =& null;  (yes I know it's wrong,
it's a typo/brain spasm)

I'm just curious - what language IS that? finnish?

Rob Agar
Web Site Consultant
Wild Lime Media - [EMAIL PROTECTED]
Studio 1, 70 McLeod Street, Cairns 4870
Tel: 07 4081 6677  |  Fax: 07 4081 6679

Web and Software Development Services  - www.wildlime.com
Search Engine Optimisation Services - search.wildlime.com
Professional Website Hosting Services -www.hostonlime.com.au

Winner 2004 Telstra North QLD Media Awards - Best Website - Online
Content & Information 

  

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



Re: [PHP] Help with dates

2005-03-14 Thread Kevin
Dear mr. Maas,

First of all my appologies for taking so long to respond. I had a family
death to attend to.

I will respond to the message in message.

Yours,

Kevin

"Jochem Maas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> ...
> >>
> >>Why re-invent the wheel?
> >
> >
> > It's part of a game. In the RPG there are dates which the players would
like
> > to be able to convert from our calendar to that one, and back again..
> >
> >
> >>>In order to do that I need to find the exact days since the year 0
> >
> > BC/AD.
>
> why is OBC relevant, I read later on that you take the start of egyptian
> civilization as zero. is that not much earlier.

Well it's relevant to make a baseline so that I can calculate the difference
from then until now. That's the only reason thusfar.

>
> whats the structure of the egyptian|rpg calendar?

A year consists of 769 days, 13 months of 63 days a month, except for month
13 which has 14 days. Every month has 7 weeks of 9 days, of course month 13
is the exception. A day is 24 hours.

>
> >
> >>>However, the functions php provides only allow up to the unix epoch.
> >>>
> >>>Could you guys give me some pointers on how to accomplish this,
> >>>accurately?
> >>
> >>Take a look at the MySQL date ranges -- They may have a data type that
> >>allows for more than just 1/1/1970 to 3/??/2038
> >>
> >>If not, consider using PostgreSQL which has VERY extensive and flexible
> >>date support, for ranges MUCH larger than 0 BC/AD.
> >>http://postgresql.org
> >>
> >>I believe PostgreSQL even supports time scales on the order of
geological
> >>events and for astronomical purposes, though not with "day" accuracy.
> >>
>
> +1 on using a DB to calculate and format dates on this one :-)
> I'm guessing Kevins probably written an SQL statement before and he's
> already proved he can RTFPM (P for PHP)
>
> >>I am assuming that by "accurately" you mean "to the nearest day" since
you
> >>spoke of "exact days", right?
> >
> >
> > Aye.. it's nearest day, and according to calculations should have
repeatable
> > results. So what is date X today should also be it tomorrow (after the
> > calculations of course). That's what i've noticed so far. when I add a
date
> > and convert it and then convert it back it is a different date.
> >
>
> show us some code :-)

At the end of the message code will be provided.

> >
 >>But you didn't define how far into the future you need to go.
> >>Current time?
> >>A few years out?
> >>Stardates from Star Trek?
> >>You have to specify a start date, end date, and accuracy to choose a
> >>correct calendar system.
> >
> >
> > It's mostly the past. The RPG is set in Egypt and the beginning of the
> > society in egypt has been taken as year 0. The start date I think is
> > obvious, but I do not understand an end date of a calendar.. Perhaps I'm
> > just blond.. but could you perhaps explain that one?
> >
>
> I must be blond, I don't even grok that question :-/

WEll I don't understand why an end date is important or what is meant with
accuracy. The term being blond is, at least in the Netherlands "a dumb
blond", so I made it so that when I am dumb or anything, I'm blond (which in
fact I am - dark blond) :-P.

>
> rgds,
> jochem

Code:

function get_date_ec($EarthDay, $EarthMonth, $EarthYear) {
$DayOfYear = 0;
# Setting internal date variables.
$intDay   = intval($EarthDay);
$intMonth   = intval($EarthMonth);
$intYear   = intval($EarthYear);
$array_MonthDays["1"] = intval(31);// January
$array_MonthDays["3"] = intval(31);// March
$array_MonthDays["4"] = intval(30);// April
$array_MonthDays["5"] = intval(31);// May
$array_MonthDays["6"] = intval(30);// June
$array_MonthDays["7"] = intval(31);// July
$array_MonthDays["8"] = intval(31);// August
$array_MonthDays["9"] = intval(30);// September
$array_MonthDays["10"] = intval(31);   // October
$array_MonthDays["11"] = intval(30);   // November
$array_MonthDays["12"] = intval(31);   // December

# Making a few Leap Year Checks
$RETURN_CHECK_LEAP_YEAR  = check_leap_year($intYear);
if ($RETURN_CHECK_LEAP_YEAR == TRUE) {
$array_MonthDays["2"] = intval(29);  // february
} else {
$array_MonthDays["2"] = intval(28);   // february
};

if ($RETURN_CHECK_LEAP_YEAR == 1) {
#check date if leapdate has passed.
echo "$intYear  is a LEAP YEAR  ";
if (($intDay >= 29) AND ($intMonth >= 2)) {
echo "LEAP DATE HAS PASSED ";
for ($n=1 ; $n<$intMonth ; $n++) {
$DayOfYear = $DayOfYear + $array_MonthDays["$n"];
$testje = $array_MonthDays["$n"]+$intDay;
echo "testje: $testje ";
   };
   $DayOfYear = $DayOfYear + $intDay;
   echo "$DayOfYear ";
   $intTotalDaysSinceEpoch = ($intYear * 365) + ($intYear / 4) +
$DayOfYear;
   echo "$intTotalDaysSinceEpoch = ($intYear*365) + ($intYear /4) +
$DayOfYear ";
   echo "

Re: [PHP] Class/object storing itself in a database

2005-03-14 Thread Zareef Ahmed
On Mon, 14 Mar 2005 12:11:40 -0800, Robby Russell <[EMAIL PROTECTED]> wrote:
> On Mon, 2005-03-14 at 14:07 -0600, Chris Boget wrote:
> > I have the following Class:
> >
> > class MyClass {
> >   function store_myself() {
> > $query = 'INSERT INTO mytable ( myfield ) VALUES ( ' . $this . ')';
> > $result = mssql_query( $query );
> >   }
> > }
> >
> > which works.  Kind of.  What I expected was a serialized copy of the
> > object to be stored in the column myfield.  However, what I am actually
> > seeing is simply the word 'Object'.
> >
> > How can I get it so that the serialize copy is stored so that I can retrieve
> > that copy later and use it as a PHP object?
> >
> > thnx,
> > Chris
> >
> 
> Try serializing it first.
> 
> What happens when you run:
> 
> echo $this;
> 
> ..your query is going to save the same thing.
> 
> try serialize($this) instead.

and do not forgot to unserialize($fieldvalue) ;)

zareef ahmed 


> 
> -Robby
> 
> --
> /***
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON  | www.planetargon.com
> * Portland, OR  | [EMAIL PROTECTED]
> * 503.351.4730  | blog.planetargon.com
> * PHP, Ruby, and PostgreSQL Development
> * http://www.robbyonrails.com/
> /
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] php 4 & php 5

2005-03-14 Thread Rasmus Lerdorf
mbneto wrote:
Simply.
My server has moved from php4 to php5 and my webmail program IMP can't
be upgraded before I find out how to do that safely for my users.
Now I have sites that need php5 and only one that does not work with it (imp).
That's why I'd like to stick with apache2 + php5 default and
apache2+php4 just for a single site hosted (the one that uses imp).
See my previous message describing the ProxyPass approach.  It is by far 
the easiest way to solve this cleanly.

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


Re: [PHP] multidimensional array sort

2005-03-14 Thread Ashley M. Kirchner
Leif Gregory wrote:
http://us3.php.net/manual/en/function.array-multisort.php
   I did go through that, but I can't get it to work and I'm almost 
willing to bet it's because of the way the array is built.  For example, 
the example on that page says that I should be able to do a sort on 
$ar[0] and $ar[1], however in my array both of those return 0.  In fact, 
when I do this:

 echo "items in array: " . count($data) . "";
 for ($i = 0; $i < count($data); $i++) {
   echo "data[$i]: " . count($data[$i]) . "";
 }

   I get:
 items in array: 2
 data[0]: 0
 data[1]: 0

   When I do a print_r($data), I get:
 Array
   (
  [John] => Array
 (
[KIRASH] => Array
  (
 [0] => 050311_18.00.59__KIRASH.zip
 [1] => 050311_18.10.20__KIRASH.zip
  )
[MCCROY] => Array
  (
 [0] => 050312_20.52.28__MCCROY.zip
  )
 )
  [Ron] => Array
 (
[EMBROR] => Array
  (
 [0] => 050314_15.47.56__EMBROR.zip
  )
 )
   )
   S, I'm at a loss here.  I think I need to create the array 
differently for it to work.

--
H | I haven't lost my mind; it's backed up on tape somewhere.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / WebSmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 

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


Re: [PHP] php 4 & php 5

2005-03-14 Thread mbneto
Simply.

My server has moved from php4 to php5 and my webmail program IMP can't
be upgraded before I find out how to do that safely for my users.

Now I have sites that need php5 and only one that does not work with it (imp).

That's why I'd like to stick with apache2 + php5 default and
apache2+php4 just for a single site hosted (the one that uses imp).

- mb


On Mon, 14 Mar 2005 16:55:09 -0500, Jason Barnett
<[EMAIL PROTECTED]> wrote:
> Richard Lynch wrote:
> ...
> [good stuff]
> ...
> >
> > Maybe if you told us WHY you need 4 & 5 we'd have better answers for ya.
> >
> 
> Agreed!  Tell us what you specifically need and we can provide better
> answers.  If you're wanting to test PHP5 with your current scripts then
> it would make sense to do exactly what Richard said.  Or if you really
> need to run it as an Apache module I suppose you could run it on a dev
> server, but you would still want Apache to be the exact same version as
> what you have on your stable / production box.
> 
> --
> Teach a man to fish...
> 
> NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
> STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
> STFM | http://php.net/manual/en/index.php
> STFW | http://www.google.com/search?q=php
> LAZY |
> http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
> 
> 
>

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



[PHP] PHP-CLI Debugging Question

2005-03-14 Thread Davy Durham
Hi.. I'm working on converting some CLI (not CGI) bash scripts to php 
and was wondering if there's an equivalent to 'set -x' from bash in php

set -x in bash basically causes the statements to be printed to stderr 
as they are executed.  Does php have something similar?

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


Re: [PHP] can't pull products from DB with REGEXP?

2005-03-14 Thread [EMAIL PROTECTED]

Marek Kilimajer wrote:
[EMAIL PROTECTED] wrote:
I have table with products. In column categories are listed numbers 
of categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for 
the moment)
Now, I have to list all products that belongs to category with cat. 
number, e.g. 11.

If I use query:
select * from products where categories like '11, '
product no. 5 will be listed but not product no. 3
select * from products where categories like '%11,% '
will list products 3 and 5 but
select * from products where categories like '%1,% '
will list products 2, 3 and 5 too - and, 3 & 5 are wrong.
I got from friend this solution:
select * from products where categories REGEXP '(^".$cat_num."|, 
".$cat_num.")'

As each record has trailing comma, include that too:
(^2,|, 2,)
Would it be that difficult to convert the column to SET Type?
http://dev.mysql.com/doc/mysql/en/set.html
Can't do that because there is 60-80 caegories and SET is limited on 64. 
And by deleting/adding new category have to change to SET array of 
values. That's not solution. But thanks on idea ;)



it works just fine if I use 2 digit cat number. e.g. 11 or 26 or 62. 
But if I select for cat. num. 2 it will list all products from 
categories 2 and everything between 20 and 29. 32 or 62 will not be 
listed.

Confusing, ha?
Thanks for any help!
-afan

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


Re: [PHP] Array Help

2005-03-14 Thread Robert Cummings
On Mon, 2005-03-14 at 18:07, Phil Neeb wrote:
> Greets,
> I'm running into the problem of not having a server that gives me database 
> access or ability to use files to store my data ... Yeah, I know, it sucks. 
> Anyway ... My page has a number of profiles about people involved with my 
> organization and all the profiles load into a set appearance.  I have all 
> the information about each person stored in individual arrays (if there's an 
> easier way to do this w/o database or files, I'd love to hear it) ... 
> anyway, I pass a variable through the URL which causes the array info to 
> load, but I use an if statement for EVERYONE which makes my work way too 
> tedious ... The variable I pass is the same value as the name each person's 
> array (the variable is stored in the link) so, I'm curious if there's a way 
> I can use the variable as the array name and cut out those tons of if 
> statements. 

if( isset( $$person ) )
{
$profile = $$person;
}

Where the value of $person is a string that corresponds to the profile
array name you wish to access.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Classes code completion and Zend Studio

2005-03-14 Thread Zareef Ahmed
On Mon, 14 Mar 2005 23:30:51 +, Alister Bulman <[EMAIL PROTECTED]> wrote:
> On Mon, 14 Mar 2005 19:14:37 +0530, Zareef Ahmed <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> >  I have a function to load the classes and return the object.
> >
> > function LoadClass($ClassName)
> > {
> > require_once("Class.$ClassName.inc");
> > return new $ClassName();
> > }
> 
> With it being a require, won't it always be loaded, whether
> theLoadClass functon is called or not?  'Include/include_once' loads
> on demand, but right now thats effectively the same as
> require_once("Class.$ClassName.inc");
> function LoadClass($ClassName) {
>   return new $ClassName();
> }
> isn't it?
> 
QUOTE From PHP Documentation at php.net 
"require() and include() are identical in every way except how they
handle failure. include() produces a Warning while require() results
in a  Fatal Error."


"NOTE: This function changed how it worked.  In PHP 3 this behaved
very differently than it does on PHP
4"

 http://in.php.net/require/

Zareef Ahmed 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] incrementing a number from a text file

2005-03-14 Thread Kurt Yoder
On Mar 14, 2005, at 12:45 PM, Richard Lynch wrote:
Select blablabla FROM t1,t2,t3
WHERE customers LIKE '%$s%'
OR name LIKE '%$s%'
OR domain LIKE '%$s%'
OR email LIKE '%$s%'
OR log LIKE '%$s%'
AND t1.id = t2.t1_id
AND t1.id = t3.t1_id
Horror!
Perhaps I'm missing something, but what's wrong with that query? It
looks like a pretty normal search query to me. If you need to search
through a bunch of records for various text fragments, and you're not
certain which field they're in, why *wouldn't* you use a query like
this?
Been there.  Done that.
Because of operator precedence, this turns into:
customers like '%$s%' or name like '%$s%' or domain like '%$s%' or 
email
like '%$s%' or (log like '%$s%' and t1.id = t2.t1_id and t1.id = 
t3.t1_id)

So you basically end up with the cartesian product of three tables for
most of the tests, and the foreign keys only kick in for the log test.
Assuming the three tables have reasonable amounts of data in them, you
then are checking count(t1) * count(t2) * count(t3) tuples with LIKE on
text fields.
This should quickly bring the database server to its knees. :-)
I'd be surprised if this kind of thing survived even the worst QA -- 
You'd
have to have hefty db server, and very small tables and VERY BAD QA to 
not
notice something was wrong.
I see. What is the best way to run this type of query then?
--
Kurt Yoder
http://yoderhome.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP/Craig's List Scripts?

2005-03-14 Thread Jim Plush
Mike check out hotscripts.com
in the PHP section, there are a billion scripts on there. you should be 
able to find one that matches your needs

Jim
carreraSC wrote:
Hi,
Has anyone ever seen a mockup or simulation of CL done in PHP, for 
download?  I need to do a small scale version of it for an unrelated 
(non-competitive) space, and I thought it might save some time.

Thanks!
Mike in Boulder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Array Help

2005-03-14 Thread Phil Neeb
Greets,
I'm running into the problem of not having a server that gives me database 
access or ability to use files to store my data ... Yeah, I know, it sucks. 
Anyway ... My page has a number of profiles about people involved with my 
organization and all the profiles load into a set appearance.  I have all 
the information about each person stored in individual arrays (if there's an 
easier way to do this w/o database or files, I'd love to hear it) ... 
anyway, I pass a variable through the URL which causes the array info to 
load, but I use an if statement for EVERYONE which makes my work way too 
tedious ... The variable I pass is the same value as the name each person's 
array (the variable is stored in the link) so, I'm curious if there's a way 
I can use the variable as the array name and cut out those tons of if 
statements. 

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



[PHP] Re: can't pull products from DB with REGEXP?

2005-03-14 Thread Jamie Alessio
I have table with products. In column categories are listed numbers of 
categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for the 
moment)
Now, I have to list all products that belongs to category with cat. 
number, e.g. 11.

Afan,
If you're using MySQL check out the FIND_IN_SET() function. Since your 
category data is comma separated you should be able to do something like:

SELECT product
FROM products
WHERE
FIND_IN_SET('11', REPLACE (categories, ' ', '')) > 0
You need the extra REPLACE() call there to remove the spaces or else 
FIND_IN_SET() for your numbers won't work properly.

Details on the function at 
http://dev.mysql.com/doc/mysql/en/string-functions.html

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


[PHP] PHP/Craig's List Scripts?

2005-03-14 Thread carreraSC
Hi,
Has anyone ever seen a mockup or simulation of CL done in PHP, for 
download?  I need to do a small scale version of it for an unrelated 
(non-competitive) space, and I thought it might save some time.

Thanks!
Mike in Boulder
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] MySQL, PHP and JBOSS

2005-03-14 Thread david joffrin
Hi,
I finally managed to run JBOSS/Tomcat with PHP, however, I am facing the 
following error message when my PHP code is accessing MySQL: Fatal error: 
Call to undefined function mysql_connect() in 
C:\APPS\jboss-3.2.6\server\sudetp\deploy\jbossweb-tomcat50.sar\ROOT.war\registration.php 
on line 87.

However, the same code runs successfully on Apache2! Any configuration that 
I am missing somewhere?

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


Re: [PHP] can't pull products from DB with REGEXP?

2005-03-14 Thread Marek Kilimajer
[EMAIL PROTECTED] wrote:
I have table with products. In column categories are listed numbers of 
categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for the 
moment)
Now, I have to list all products that belongs to category with cat. 
number, e.g. 11.

If I use query:
select * from products where categories like '11, '
product no. 5 will be listed but not product no. 3
select * from products where categories like '%11,% '
will list products 3 and 5 but
select * from products where categories like '%1,% '
will list products 2, 3 and 5 too - and, 3 & 5 are wrong.
I got from friend this solution:
select * from products where categories REGEXP '(^".$cat_num."|, 
".$cat_num.")'
As each record has trailing comma, include that too:
(^2,|, 2,)
Would it be that difficult to convert the column to SET Type?
http://dev.mysql.com/doc/mysql/en/set.html
it works just fine if I use 2 digit cat number. e.g. 11 or 26 or 62. But 
if I select for cat. num. 2 it will list all products from categories 2 
and everything between 20 and 29. 32 or 62 will not be listed.

Confusing, ha?
Thanks for any help!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Dan Tappin
Why not make it simple?:
// end PHP code ?>
]' 
value='true'>


Dan T
On Mar 14, 2005, at 3:58 PM, Jeff Schmidt wrote:
Hello,
  I'm beating my head, and can't figure out *WHY* PHP is giving me 
this error. The full error text is:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, 
expecting T_STRING or T_VARIABLE or T_NUM_STRING in 
/hsphere/local/home/welding/weldingconsultants.com/wcapp/admin.php on 
line 82

Line 82 is:
print '\n";

The problem seems to have something to do with the construct 
$row["profileID"] - I say this, because I pulled that out into a 
seperate line before this, at one point, just to test, and assigned it 
to a variable, and put the variable in place of the array access. That 
is, to test, at one point, my file had:

$profID = $row["profileID"];
print '\n";

When I had done that, the parser started choking at the top line.
I've attached the full file, to see the context that this is in.
Can *anyone* explain this error? It's completely breaking my script. I 
suspect, that the *real* error is somewhere earlier in the file, but 
I've read through it 20 times and just can't find anything out of 
place (can't find any obvious syntax errors, for example).

Thanks for any help you can give me,
Jeff Schmidt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Chris W. Parker
Jason Barnett 
on Monday, March 14, 2005 3:57 PM said:

> Chris W. Parker wrote:
>> Chris W. Parker <>
>> on Monday, March 14, 2005 3:15 PM said:
>> 
>> 
 Line 82 is:
 print '>>> $row["profileID"] . ']' . "' value='true'/>\n";
>>> 
>>> Very likely the problem is not on line 82, but rather before it.
>>> Line 82 is just where the PHP parser finally gets screwed up.
>> 
>> 
>> Ohh .. and if i read it more fully the first time I would have seen
>> that you've got some funky in/out quoting problems and that you're
>> not escaping the quotes wrapping 'true'. :)
>> 
> 
> Quotes look ok to me?  God bless VIM (even on this old windows box) :)

I realized my mistake about two seconds after I'd send and decided not
to reply to myself twice. :(

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



Re: [PHP] long mysql_connect times

2005-03-14 Thread Dan Tappin
Just an update... on a hunch I changed my mysql_connect to 
mysql_pconnect.  As expected the first one still takes 5 to 10 seconds 
and after that subsequent pages load instantly as expected.

Dan T
On Mar 14, 2005, at 3:07 PM, Dan Tappin wrote:
I have a PHP5.x site under development with MySQL 4.1.x.  I had the 
site running fine and there were no speed issues at all.  Everything 
is on the same system (a dual G5 Xserve).

Today however the PHP pages with MySQL calls started to take forever 
to load.  Static html and php files still loaded instantly.

I tracked the issue down to mysql_connect.  Initial calls to this 
function are taking 5 to 10 seconds each.  Subsequent calls missing a 
mysql_close call do not have the latency issue.  Normally I try have 
each call to mysql_connect followed by a mysql_close to keep my mysql 
tales in order.

I have tried:
 - loading the pages remotely and locally (both slow)
 - checked the Apache / MySQL logs
 - manually ran the mysql queries to check for slow queries (all 0.0x 
seconds duration)
 - restarted apache / mysql

My next step is a hard restart (off hours later tonight) but until 
then I was wondering if anyone has any ideas?  I am stumped.

Thanks,
Dan T
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Andre Dubuc
On Monday 14 March 2005 06:22 pm, Chris W. Parker wrote:
> Chris W. Parker <>
>
> on Monday, March 14, 2005 3:15 PM said:
> >> Line 82 is:
> >> print ' >> $row["profileID"] . ']' . "' value='true'/>\n";
> >
> > Very likely the problem is not on line 82, but rather before it. Line
> > 82 is just where the PHP parser finally gets screwed up.
>
> Ohh .. and if i read it more fully the first time I would have seen that
> you've got some funky in/out quoting problems and that you're not
> escaping the quotes wrapping 'true'. :)
>
>
>
> Chris.

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



Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Jason Barnett
Chris W. Parker wrote:
> Chris W. Parker <>
> on Monday, March 14, 2005 3:15 PM said:
>
>
>>>Line 82 is:
>>>print '>>$row["profileID"] . ']' . "' value='true'/>\n";
>>
>>Very likely the problem is not on line 82, but rather before it. Line
>>82 is just where the PHP parser finally gets screwed up.
>
>
> Ohh .. and if i read it more fully the first time I would have seen that
> you've got some funky in/out quoting problems and that you're not
> escaping the quotes wrapping 'true'. :)
>

Quotes look ok to me?  God bless VIM (even on this old windows box) :)

In any case Chris' original suggestion is probably right... it's likely
that the last place you used quotes *before* line 82 is missing a
closing quote.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread M. Sokolewicz
Chris W. Parker wrote:
Chris W. Parker <>
on Monday, March 14, 2005 3:15 PM said:

Line 82 is:
print '\n";
Very likely the problem is not on line 82, but rather before it. Line
82 is just where the PHP parser finally gets screwed up.

Ohh .. and if i read it more fully the first time I would have seen that
you've got some funky in/out quoting problems and that you're not
escaping the quotes wrapping 'true'. :)

Chris.
that's because he's using single quotes for his value there, and double 
quotes to denote it being a string in that last part...

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


RE: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Chris W. Parker
Chris W. Parker <>
on Monday, March 14, 2005 3:15 PM said:

>> Line 82 is:
>> print '> $row["profileID"] . ']' . "' value='true'/>\n";
> 
> Very likely the problem is not on line 82, but rather before it. Line
> 82 is just where the PHP parser finally gets screwed up.

Ohh .. and if i read it more fully the first time I would have seen that
you've got some funky in/out quoting problems and that you're not
escaping the quotes wrapping 'true'. :)



Chris.

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



RE: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Chris W. Parker
Jeff Schmidt 
on Monday, March 14, 2005 2:58 PM said:

> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> /hsphere/local/home/welding/weldingconsultants.com/wcapp/admin.php on
> line 82
> 
> Line 82 is:
> print ' $row["profileID"] . ']' . "' value='true'/>\n";

Very likely the problem is not on line 82, but rather before it. Line 82
is just where the PHP parser finally gets screwed up.

> $profID = $row["profileID"];
> print ' "' value='true'/>\n";
> 
> When I had done that, the parser started choking at the top line.

I suggest the following: (The HTML should all be on one line.)

echo "";

> I've attached the full file, to see the context that this is in.

Please don't send attachments to a public mailing list. Besides, I don't
think they go through anyway.

> Can *anyone* explain this error? It's completely breaking my script. I
> suspect, that the *real* error is somewhere earlier in the file, but
> I've read through it 20 times and just can't find anything out of
> place (can't find any obvious syntax errors, for example).

Post the file to a web server somewhere in plain text.



Chris.

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



Re: [PHP] function reverse to get_object_vars

2005-03-14 Thread Robert Cummings
On Mon, 2005-03-14 at 13:26, kamen 123 wrote:
> Hello
> 
> Do you know how to implement function reverse to get_object_vars?
> For example if I have class and I wish to set it's properties from database 
> with loop through the columns in table?

Something like this?

$obj->$fieldName = $fieldValue;

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE

2005-03-14 Thread Jeff Schmidt
Hello,
  I'm beating my head, and can't figure out *WHY* PHP is giving me this 
error. The full error text is:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, 
expecting T_STRING or T_VARIABLE or T_NUM_STRING in 
/hsphere/local/home/welding/weldingconsultants.com/wcapp/admin.php on 
line 82

Line 82 is:
print '\n";

The problem seems to have something to do with the construct 
$row["profileID"] - I say this, because I pulled that out into a 
seperate line before this, at one point, just to test, and assigned it 
to a variable, and put the variable in place of the array access. That 
is, to test, at one point, my file had:

$profID = $row["profileID"];
print '\n";

When I had done that, the parser started choking at the top line.
I've attached the full file, to see the context that this is in.
Can *anyone* explain this error? It's completely breaking my script. I 
suspect, that the *real* error is somewhere earlier in the file, but 
I've read through it 20 times and just can't find anything out of place 
(can't find any obvious syntax errors, for example).

Thanks for any help you can give me,
Jeff Schmidt
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: [PHP-DEV] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled

2005-03-14 Thread Pierre-Alain Joye
On Mon, 14 Mar 2005 14:20:36 -0500
[EMAIL PROTECTED] (Greg Beaver) wrote:

> Edin Kadribasic wrote:
> > Windows binaries are now available at:
> > 
> > PHP 5.0.4RC1
> > http://downloads.php.net/edink/php-5.0.4RC1-Win32.zip
> > 
> > PHP 4.3.11RC1
> > http://downloads.php.net/edink/php-4.3.11RC1-Win32.zip
> > 
> > Additional downloads for PHP 5.0.4RC1:
> > http://downloads.php.net/edink/pecl-5.0.4RC1-Win32.zip
> > http://downloads.php.net/edink/php-debug-pack-5.0.4RC1-Win32.zip
> 
> The PEAR bundles are ridiculously out of date for both PHP 5.0.4
> and  4.3.11, where is the windows build pulling these versions
> from?

Feel like it was not updated on the building host. PEAR should be
1.3.5, I do not remember the other, but the script should be
updated.

Regards,

--Pierre

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



Re: [PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Craig Lewis

The files in question are 'within' the open_basedir directive.
To explain further/better
within virtualhost,
php_admin_value open_basedir /www/htdocs/midwifefinder.com/site
and...
/www/htdocs/midwifefinder.com/site/index.php contains
===

require_once("includes/app.php");

which is /www/htdocs/midwifefinder.com/site/includes/app.php and this 
file contains

===

but I have tried this with simple file names and a simpler structure, 
the contents of add.php is
parsed, and the contents of config/_config.php is never parsed.

why not just add the necessary directories to the open_basedir setting
(I'm guessing it can take multiple dirs because the error says 
'allowed path(s)')?
e.g.:
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php

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


RE: [PHP] Re: bulk emailer

2005-03-14 Thread Chris W. Parker
Manuel Lemos 
on Monday, March 14, 2005 2:05 PM said:

> Usually you can tell the sendmail program to just queue the messages
> instead of deliverying them immediately using the delivery mode switch
> od . If you want to see how that is done, take a look at the
> sendmail_message_class of this package:
> 
> http://www.phpclasses.org/mimemessage

Anyway to get it without signing up?



Chris.

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



[PHP] function reverse to get_object_vars

2005-03-14 Thread kamen 123
Hello

Do you know how to implement function reverse to get_object_vars?
For example if I have class and I wish to set it's properties from database 
with loop through the columns in table?

-
http://gbg.bg/search - Изпробвайте още сега най-добрата българска търсачка!

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



[PHP] file/array manipulation

2005-03-14 Thread Mignon Hunter
Hello

I'm trying to manipulate a text(.csv) file using php. I've read the file and 
can print each line,
 but I need to write where column A is missing

ColumnAColumnB

RABC company
  ABC company
  ABC company
  ABC company
OXYZ company
   XYZ company
   XYZ company
   XYZ company

What I need to do is write a while loop (I think) to interate through the lines 
and populate ColumnA 
while ColumnB equals $var (ABC company then XYZ company), so that I end up with:

ColumnAColumnB

RABC company
RABC company
RABC company
RABC company
OXYZ company
OXYZ company
OXYZ company
OXYZ company

Is this possible. What I've got so far to print out the file:

$lines = file('test2.csv');

// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
  echo "Line #{$line_num} : " . $line . "\n";
}


Thanks in advance

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



Re: [PHP] Re: bulk emailer

2005-03-14 Thread Pedro Luis Cruz Riguetti
quitenme de la lista porfavor quiero salir de aqui
-- 






---
Banco de Crédito BCP - Dedicados a hacerte la Banca más simple.
Visita nuestra Banca por Internet http://www.viabcp.com
---

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



[PHP] long mysql_connect times

2005-03-14 Thread Dan Tappin
I have a PHP5.x site under development with MySQL 4.1.x.  I had the 
site running fine and there were no speed issues at all.  Everything is 
on the same system (a dual G5 Xserve).

Today however the PHP pages with MySQL calls started to take forever to 
load.  Static html and php files still loaded instantly.

I tracked the issue down to mysql_connect.  Initial calls to this 
function are taking 5 to 10 seconds each.  Subsequent calls missing a 
mysql_close call do not have the latency issue.  Normally I try have 
each call to mysql_connect followed by a mysql_close to keep my mysql 
tales in order.

I have tried:
 - loading the pages remotely and locally (both slow)
 - checked the Apache / MySQL logs
 - manually ran the mysql queries to check for slow queries (all 0.0x 
seconds duration)
 - restarted apache / mysql

My next step is a hard restart (off hours later tonight) but until then 
I was wondering if anyone has any ideas?  I am stumped.

Thanks,
Dan T
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: bulk emailer

2005-03-14 Thread Manuel Lemos
Hello,
on 03/14/2005 06:15 PM Redmond Militante said the following:
For starters,  just stay away from SMTP based solutions if you can. It 
works but it takes much longer to queue messages that some alternatives 
because you need to deal with TCP overhead, which is silly when your MTA 
is in the same machine.

The best alternative is to inject the messages in the local mailer queue 
and tell it to no start delivering the messages immediately.

If you can use sendmail (or exim ) there are some switches for the 
sendmail command for that purpose. Using qmail or postfix does not 
require any switches.

i have sendmail on this system.
anyone have links on how to inject messages into the local mailer queue?
Usually you can tell the sendmail program to just queue the messages 
instead of deliverying them immediately using the delivery mode switch 
od . If you want to see how that is done, take a look at the 
sendmail_message_class of this package:

http://www.phpclasses.org/mimemessage

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php 4 & php 5

2005-03-14 Thread Jason Barnett
Richard Lynch wrote:
...
[good stuff]
...
>
> Maybe if you told us WHY you need 4 & 5 we'd have better answers for ya.
>

Agreed!  Tell us what you specifically need and we can provide better
answers.  If you're wanting to test PHP5 with your current scripts then
it would make sense to do exactly what Richard said.  Or if you really
need to run it as an Apache module I suppose you could run it on a dev
server, but you would still want Apache to be the exact same version as
what you have on your stable / production box.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] can't pull products from DB with REGEXP?

2005-03-14 Thread [EMAIL PROTECTED]
I have table with products. In column categories are listed numbers of 
categories a product belongs, like:
1. 21,
2. 35, 8, 72, 1, 4,
3. 23, 11, 48,
4. 65,
5. 11,
6. 23,
7. ...
(somebody else created the table this way and I have to keep it for the 
moment)
Now, I have to list all products that belongs to category with cat. 
number, e.g. 11.

If I use query:
select * from products where categories like '11, '
product no. 5 will be listed but not product no. 3
select * from products where categories like '%11,% '
will list products 3 and 5 but
select * from products where categories like '%1,% '
will list products 2, 3 and 5 too - and, 3 & 5 are wrong.
I got from friend this solution:
select * from products where categories REGEXP '(^".$cat_num."|, 
".$cat_num.")'
it works just fine if I use 2 digit cat number. e.g. 11 or 26 or 62. But 
if I select for cat. num. 2 it will list all products from categories 2 
and everything between 20 and 29. 32 or 62 will not be listed.

Confusing, ha?
Thanks for any help!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php 4 & php 5

2005-03-14 Thread Richard Lynch
> What I am trying to avoid is having 2 copies of the same program
> installed...

Well, if you're gonna have PHP 4 and PHP 5, you're gonna have to have two
copies of PHP...

You could run both under Apache 1.x, but running PHP 5 with Apache 1.x
means you aren't going to be taking advantage of any of the cool features
of 2.x anyway, so why do that?

Running 4 with Apache 2.x, same thing: PHP 4 doesn't leverage anything
cool from Apache 2.x, so you might as well take the safe road with Apache
1.x

For more accurate statements of the above, see:
http://us3.php.net/manual/en/faq.migration5.php
http://us3.php.net/manual/en/migration5.php

So, ideally, you'd be running:
PHP 4 + Apache 1.x
PHP 5 + Apache 2.x
if you want to try out new things in leading edge versions.

But let's assume you just want to test your PHP4 scripts in PHP5, which
would make sense.

You're only going to install Apache 1.x ONCE, but you're going to HAVE to
run 2 pools of httpd running to have PHP4 and PHP5 Modules installed,
probably.

Actually, I guess you could run PHP5 as a CGI, knowing that that will
automatically break a *few* things (HTTP Authentication, for example) but
test *most* of your scripts that way.

Compile PHP 5 as CGI, and use something like:
AddType application/x-httpd-php5 .php5

Then, in an .htaccess file where you have your PHP5 scripts you are
migrating, you could use:

  ForceType application/x-httpd-php5


This would not be suitable for a heavy load production server, and you're
GOING to have some issues to track down where it's just CGI messing things
up, not PHP5, really, but it's do-able.

Maybe if you told us WHY you need 4 & 5 we'd have better answers for ya.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Directory and file permissions on a virtual host

2005-03-14 Thread Richard Lynch
> Would some please provide me some simple rules for dealing with php
> scripts to
> fopen(), copy() and move_uploaded_file().
>
> Environment is Linux, Apache on a virtual host
>
> I've spent a lot of time goggling, etc. and can find lot's of explanations
> for
> owner, group and world.  They sound great; but don't work for me.
>
> This stuff worked on our previous host, it simply assigned  "customer" to
> everything

Your current host has given you TWO different usernames, sort of.

One is the one you use to login to the shell.  This is probably something
like 'al' or 'ridersite' or some variant on your name/site.

The other is the one running Apache/PHP.  This is probably 'nobody' or
'apache' or 'www' or something like that.

If you want PHP from the web to be able to do something to a file, you
need to make that file owned by the Apache user.

> Here is my directory structure and permissions:
>
> /foo [user accessed php scripts] permissions= 755
> /foo/data [simple text files] permissions = 777
> files in /data permissions= 644
>
> Have tried lots of other dir and file permissions
>
> owerships are our site handle.

Here's what you do to get a whole directory OWNED by the PHP user:

Step 1: TEMPORARILY make a directory world-writable with "chmod 777 xxx"
Step 2: Write a PHP script to create a directory (http://php.net/mkdir)
*inside* that directory: 
Step 3: Change xxx back to sensible permissions: "chmod 755 xxx"

Ideally, you would make this directory owned by PHP *not* in your web
tree, but in some other directory.

You would then write PHP scripts to provide access to that directory.

Those scripts would then contain code to make *SURE* the content you were
sending out "looked right"

The reason for this is that the php_owned directory can be altered by
*ANYBODY* who can write a PHP script on your server.

So if you have some cross-checks in your scripts before you serve up the
content, you can "catch" that kind of thing.

You can cross-reference the files in that directory with records in a
database of what you expect to be there.

You can make sure that images "look" like image files with
http://php.net/imagegetsize

In your case, you could store the last known size of the file in your
database, and check that right before you append to make sure somebody
else hasn't snuck some data in there.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] password Boxes

2005-03-14 Thread Jochem Maas
Dotan Cohen wrote:
On Mon, 14 Mar 2005 16:25:32 +0100, Jochem Maas <[EMAIL PROTECTED]> wrote:
yeah ... but next time read the question before you answer ;-)
the guy was wondering how to change which character was used as
the mask in password fields - normally its an asterisk, if
you use WinXP with the std. wibbly-wobbly-blue-bubble-wrap theme
it shows a small (filled) circle instead... earth-shattering.
:-)

I stand corrected! As a Fedora user, I have never seen those circles,
so I did fully understand the question. And, being OT, maybe a
personal email to the OP would have been better, but for the archives
I opted to answer on-list.
cool.
Would I be cynical if I suggested a different solution to the problem?
http://www.mozilla.org/products/firefox/
that's anything but cynical :-)
besides if you are developing web stuff you probably should be
running a number of diff. browsers regulary?

Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: bulk emailer

2005-03-14 Thread Redmond Militante
hi

[Sat, Mar 12, 2005 at 08:42:15PM -0300]
This one time, at band camp, Manuel Lemos said:

> Hello,
> 
> 
> For starters,  just stay away from SMTP based solutions if you can. It 
> works but it takes much longer to queue messages that some alternatives 
> because you need to deal with TCP overhead, which is silly when your MTA 
> is in the same machine.
> 
> The best alternative is to inject the messages in the local mailer queue 
> and tell it to no start delivering the messages immediately.
> 
> If you can use sendmail (or exim ) there are some switches for the 
> sendmail command for that purpose. Using qmail or postfix does not 
> require any switches.
>

i have sendmail on this system.
anyone have links on how to inject messages into the local mailer queue?

 
> In any case, you may want to try this MIME message composing and sending 
> class. It provides several means to optimize bulk deliveries, 
> personalized or not. You can pick a sub-class to optimize deliveries for 
> the MTA that you use. There are sub-classes for mail, sendmail (or exim 
> or postfix), qmail, SMTP or Windows pickup folder are supported.
> 
> Regardless of which you use, always call SetBulkMail() function before 
> start looping deliveries to your users.
> 
> If you are not personalizing message, you can tell the class to cache 
> message bodies between deliveries to avoid message regeneration overhead.
> 
> If you want to personalize messages, you can even use Smarty as template 
> engine to speedup personalized message generation.
> 
> There are several examples to demonstrate this:
> 
> http://www.phpclasses.org/mimemessage
> 
> 
> 
> -- 
> 
> Regards,
> Manuel Lemos
> 
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
> 
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
> 
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html

-- 
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
 3:00PM  up 12 days,  3:57, 3 users, load averages: 0.00, 0.00, 0.00


pgpGc8EWPMzXB.pgp
Description: PGP signature


Re: [PHP] password Boxes

2005-03-14 Thread Dotan Cohen
On Mon, 14 Mar 2005 16:25:32 +0100, Jochem Maas <[EMAIL PROTECTED]> wrote:
> 
> yeah ... but next time read the question before you answer ;-)
> the guy was wondering how to change which character was used as
> the mask in password fields - normally its an asterisk, if
> you use WinXP with the std. wibbly-wobbly-blue-bubble-wrap theme
> it shows a small (filled) circle instead... earth-shattering.
> 
> :-)
> 

I stand corrected! As a Fedora user, I have never seen those circles,
so I did fully understand the question. And, being OT, maybe a
personal email to the OP would have been better, but for the archives
I opted to answer on-list.

Would I be cynical if I suggested a different solution to the problem?
http://www.mozilla.org/products/firefox/


Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com

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



Re: [PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Jochem Maas
Craig Lewis wrote:
Hello,
I have just attempted to migrate for the first time from  php4 to php5. 
The problem i am having is some sort of change in how the open_basedir 
directive works in php 5. I don't see much discussion about this, so I 
must be doing something stupid, otherwise, I would think there would be 
a lot of people bumping into this.

On both servers I have safe mode on and open_basedir directive set for 
the virtual host in apache. The offending php code from the top level 
file calls another php file with require_once ('path/file.php') and then 
file.php in turn calls another php file require_once ('path/file2'). Its 
this second require_once that causes the fatal  error, in otherwords, I 
can call the first file with require_once, and put just about any sort 
of reasonable php code in this file, and it works, i.e. its included in 
the origional file. When the called file, calls another file, in php 5, 
I get an error,

==
Warning: main() [function.main]: open_basedir restriction in effect. 
File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is 
not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3
the way I read it your config only allows you to open files inside of:
/www/htdocs/midwifefinder.com/site
looks to me like php5 is doing what its supposed to, maybe php4
was actually broken which allowed the require to work when it
wasn't supposed to.
why not just add the necessary directories to the open_basedir setting
(I'm guessing it can take multiple dirs because the error says 'allowed 
path(s)')?
e.g.:
/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php
 ^--- ? 
Warning: main(config/_config.inc.php) [function.main]: failed to open 
stream: Operation not permitted in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Fatal error: main() [function.require]: Failed opening required 
'config/_config.inc.php' 
(include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3


The code and paths are unchanged, works on php4, not on php5, apache  
version unchanged. (1.3.x). I have tried various php.ini files, of 
course turning open_basedir off will make the error go away. The file 
being called is clearly within the scope of the open_basedir 
restriction, and thus it works just fine in php4.

/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the 
correct path to the file, I guess because it doesn't find the file in 
the . (dot) part of the include path, then it blows up when it tries to 
find the file in (what is basically) /usr/local/lib/php.

This kind of sounds like a TRANSPATH related problem, and its certainly 
a path problem (where is dot), but as I read the docs, TRANSPATH is 
something that changed for apache 2.

Any advice would be appreciated.
CL
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] bulk emailer

2005-03-14 Thread Redmond Militante
can anyone recommend a good mailing list software that may be adapted for these 
purposes?

[Fri, Mar 11, 2005 at 02:34:01PM -0800]
This one time, at band camp, Richard Lynch said:

> 
> A better answer, all around, might be to use a mailing list software
> package for sending bulk email -- They've been fine-tuned to be really
> good at it.
> 
> -- 
> Like Music?
> http://l-i-e.com/artists.htm

-- 
Redmond Militante
Software Engineer / Medill School of Journalism
FreeBSD 5.2.1-RELEASE-p10 #0: Wed Sep 29 17:17:49 CDT 2004 i386
 3:00PM  up 12 days,  3:57, 3 users, load averages: 0.00, 0.00, 0.00


pgpt6JqGL6wKa.pgp
Description: PGP signature


[PHP] Directory and file permissions on a virtual host

2005-03-14 Thread Al
Would some please provide me some simple rules for dealing with php scripts to 
fopen(), copy() and move_uploaded_file().

Environment is Linux, Apache on a virtual host
I've spent a lot of time goggling, etc. and can find lot's of explanations for 
owner, group and world.  They sound great; but don't work for me.

This stuff worked on our previous host, it simply assigned  "customer" to 
everything
Here is my directory structure and permissions:
/foo [user accessed php scripts] permissions= 755
/foo/data [simple text files] permissions = 777
files in /data permissions= 644
Have tried lots of other dir and file permissions
owerships are our site handle.
All I want to do is have the user http upload a file
and use move_uploaded_file() to put it in my /foo/data
Then later, a script fopen()s the file to read an append data to it.
Just prior to appending to the file, I use copy() and rename it to anyname.bak
I've fooled around around with shell access and chown and chmod to make things 
work; but, I can't believe this is necessary.

Of course, once the script can't access the file, it can't change the 
permissions or ownership

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


Re: [PHP] PHP causes Apache segmentation fault? [SOLVED]

2005-03-14 Thread John Swartzentruber
On 3/14/2005 1:26 PM Richard Lynch wrote:
PHP I'm already building from Source. Uninstalling all of MySQL doesn't
seem to be an option because of that dovecot dependency.
What I'd really like to know (among so many other things) is how
configure is determining which MySQL it should use. Also knowing the
difference between PHP via a browser (via apache) and PHP on the command
line would give me some clues. I don't understand why the client API
version for mysqli is different according to how PHP is accessed.

Suppose, just for the sake of argument, that your Apache had
mod_auth_mysql compiled into it.
Also suppose, for the sake of argument, that it was on version MySQL 3
when you did that.
When you try to compile PHP, it *CANNOT* use MySQL 4 in the PHP Module, or
Apache's mod_auth_mysql would get all fargled up.
The CLI version, however, does not have that constraint.
*MAYBE* configure is smart enough to figure this kind of stuff out, and
that's why you got what you got.
More likely, you've still got MySQL 3 installed somewhere on your system.
If you're not willing to un-install that, and configure isn't finding the
version you want to use, then start reading/hacking the Makefiles that
configure builds.

A-ha! Thank you! This is the kind of information I was looking for. I 
looked into mod_auth_mysql. It isn't compiled in, but it appears that it 
specifically wants to use libmysqlclient.so.10. That's the old version. 
I'm not (to the best of my knowledge) using mod_auth_mysql, so I removed 
the line that loaded it. After restarting Apache, the client api version 
jumped up to 4.1.10a, where it belongs. If I do want to use 
mod_auth_mysql, it looks simple enough to download the latest version 
and build it from source.

Thank you again for your help.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php 4 & php 5

2005-03-14 Thread mbneto
Hi Hans,

What I am trying to avoid is having 2 copies of the same program installed...

- mb

On Sun, 13 Mar 2005 22:06:15 -0500, Hans Zaunere <[EMAIL PROTECTED]> wrote:
> 

> > Any tips regarding the configuration of php and/or apache ?
> 
> Per option 1 below, they were saying two installs of Apache or one install of 
> Apache directed to use different httpd.conf files, then to use different 
> ports for each instance.  The same thing can be accomplished using two IP 
> addresses if available, instead of two different points.
> 
> ---
> Hans Zaunere
> President, Founder
> 
> New York PHP
> http://www.nyphp.org
> 
> AMP Technology

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



Re: [PHP] HELP TO GET OUT OF PHP MAILING LIST

2005-03-14 Thread Brian Dunning
I did not subscribe to it in the first place
There goes that nefarious PHP-General again, randomly subscribing 
unsuspecting innocents as part of its evil master plan

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


Re: [PHP] Class/object storing itself in a database

2005-03-14 Thread Robby Russell
On Mon, 2005-03-14 at 14:07 -0600, Chris Boget wrote:
> I have the following Class:
> 
> class MyClass {
>   function store_myself() {
> $query = 'INSERT INTO mytable ( myfield ) VALUES ( ' . $this . ')';
> $result = mssql_query( $query );
>   }
> }
> 
> which works.  Kind of.  What I expected was a serialized copy of the
> object to be stored in the column myfield.  However, what I am actually
> seeing is simply the word 'Object'.
> 
> How can I get it so that the serialize copy is stored so that I can retrieve
> that copy later and use it as a PHP object?
> 
> thnx,
> Chris
> 

Try serializing it first.

What happens when you run:

echo $this;

..your query is going to save the same thing.

try serialize($this) instead.

-Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP, Ruby, and PostgreSQL Development
* http://www.robbyonrails.com/
/

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



[PHP] Class/object storing itself in a database

2005-03-14 Thread Chris Boget
I have the following Class:

class MyClass {
  function store_myself() {
$query = 'INSERT INTO mytable ( myfield ) VALUES ( ' . $this . ')';
$result = mssql_query( $query );
  }
}

which works.  Kind of.  What I expected was a serialized copy of the
object to be stored in the column myfield.  However, what I am actually
seeing is simply the word 'Object'.

How can I get it so that the serialize copy is stored so that I can retrieve
that copy later and use it as a PHP object?

thnx,
Chris

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



[PHP] file/array manipulation

2005-03-14 Thread Mignon Hunter
Hello

I'm trying to manipulate a text(.csv) file using php. I've read the file and 
can print each line,
 but I need to write where column A is missing

ColumnAColumnB

RABC company
  ABC company
  ABC company
  ABC company
OXYZ company
   XYZ company
   XYZ company
   XYZ company

What I need to do is write a while loop (I think) to interate through the lines 
and populate ColumnA 
while ColumnB equals $var (ABC company, XYZ company), so that I end up with:

ColumnAColumnB

RABC company
RABC company
RABC company
RABC company
OXYZ company
OXYZ company
OXYZ company
OXYZ company

Is this possible. What I've got so far to print out the file:

$lines = file('test2.csv');

// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
  echo "Line #{$line_num} : " . $line . "\n";
}


Thanks in advance

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



[PHP] file/array manipulation

2005-03-14 Thread Mignon Hunter
Hello

I'm trying to manipulate a text(.csv) file using php. I've read the file and 
can print each line,
 but I need to write where column A is missing

ColumnAColumnB

RABC company
  ABC company
  ABC company
  ABC company
OXYZ company
   XYZ company
   XYZ company
   XYZ company

What I need to do is write a while loop (I think) to interate through the lines 
and populate ColumnA 
while ColumnB equals $var (ABC company then XYZ company), so that I end up with:

ColumnAColumnB

RABC company
RABC company
RABC company
RABC company
OXYZ company
OXYZ company
OXYZ company
OXYZ company

Is this possible. What I've got so far to print out the file:

$lines = file('test2.csv');

// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
  echo "Line #{$line_num} : " . $line . "\n";
}


Thanks in advance

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



Re: [PHP] multidimensional array sort

2005-03-14 Thread Leif Gregory
Hello Ashley,

Monday, March 14, 2005, 12:12:19 PM, you wrote:
A> I need to do a sort on the whole thing in such a way that:
A>a) all the Dir#'s are in ascending order, and
A>b) all the User#'s are in ascending order with each Dir#, and
A>b) all the File#'s are also in ascending order within each User#


http://us3.php.net/manual/en/function.array-multisort.php


It's funny, I was in the exact same boat this morning with regards to
generating a sign-in sheet for a class where I had pulled out all the
students into a multi-dimensional array and needing to sort them by
last name ascending. I was just about to delve into array-multisort
when it dawned on me that this would be the perfect opportunity for a
table join. So, I learned how to do a MySQL join (my first) a few
hours ago. It works great! Much less headache too.

$sqlRegisteredStudents="SELECT s.id, s.firstName, s.lastName, s.phone, s.email, 
s.divisionOrFacility, s.supervisorName " .
"FROM " . $tbl_registrations . " r JOIN " . 
$tbl_students . " s " .
"ON r.studentId = s.id " .
"WHERE courseId='" . $_POST['courseID'] . "' " .
"ORDER BY s.lastName ASC";

-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.2.3 Rush under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



[PHP] Re: [PHP-DEV] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled

2005-03-14 Thread Greg Beaver
Edin Kadribasic wrote:
Windows binaries are now available at:
PHP 5.0.4RC1
http://downloads.php.net/edink/php-5.0.4RC1-Win32.zip
PHP 4.3.11RC1
http://downloads.php.net/edink/php-4.3.11RC1-Win32.zip
Additional downloads for PHP 5.0.4RC1:
http://downloads.php.net/edink/pecl-5.0.4RC1-Win32.zip
http://downloads.php.net/edink/php-debug-pack-5.0.4RC1-Win32.zip
The PEAR bundles are ridiculously out of date for both PHP 5.0.4 and 
4.3.11, where is the windows build pulling these versions from?

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


[PHP] multidimensional array sort

2005-03-14 Thread Ashley M. Kirchner
   I have a multidimensional array that's built as follows (it's pretty 
much a directory tree):

Array (
 [Dir1] => Array (
 [User1] => Array (
 [0] => File1
 [1] => File2
 )
 [User2] => Array {
 [0] => File1
 [1] => File2
 [2] => File3
 }
 )
 [Dir2] => Array (
 [User1] => Array (
 [0] => File1
 [1] => File2
 [2] => File3
 [3] => File4
 )
 [User2] => Array {
 [0] => File1
 }
 )
)
   I need to do a sort on the whole thing in such a way that:
  a) all the Dir#'s are in ascending order, and
  b) all the User#'s are in ascending order with each Dir#, and
  b) all the File#'s are also in ascending order within each User#
   I don't suppose there's an easy way to do this, other than doing it 
in several steps, is there?  Is there even a way to JUST sort the Dir#'s 
(and the rest gets done at a later stage in the script)?

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


[PHP] Re: Classes code completion and Zend Studio

2005-03-14 Thread Jamie Alessio
I have a function to load the classes and return the object.
function LoadClass($ClassName)
{
require_once("Class.$ClassName.inc");
return new $ClassName();
}
Its working fine.
But Zend Studio's Code completion is not working for this type of
object, Any hints?
Zareef,
In Zend Studio 4.0 (not sure about earlier versions) you can use a 
"class type hint" to let the editor know what type of object you are 
working with. This is especially useful when you are using factory 
methods to create objects (as I often do with PEAR DataObjects) or have 
a setup similar to the above. The documentation for this in the studio 
distribution appears to be broken because it says something like "See 
below for example" but there is actually no example (I filed a bug with 
Zend about this). Butm, if you dig through he "Quick Tips" you can find 
the example which is where I first came across it.

Here's how I use it for DataObjects:
--
$user_obj =& DB_DataObject::factory('User');
/* @var $user_obj DataObjects_User */
$user_obj->youShouldHaveCodeCompletionNowForThisObject();
--
In your example it would be something like:
--
$user_obj = LoadClass('user');
/* @var $user_obj user */
$user_obj->youShouldHaveCodeCompletionNowForThisObject();
--
You'll need to make sure that Zend Studio knows to look through the file 
that contains the class that you are dynamically loading. I think you 
can do this if your code is withint a "project" and you specify it with 
"Add to Project".

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


[PHP] Re: Classes code completion and Zend Studio

2005-03-14 Thread Zareef Ahmed
On Mon, 14 Mar 2005 10:28:06 -0800, Jamie Alessio
<[EMAIL PROTECTED]> wrote:
> > I have a function to load the classes and return the object.
> >
> > function LoadClass($ClassName)
> > {
> > require_once("Class.$ClassName.inc");
> > return new $ClassName();
> > }
> >
> > Its working fine.
> >
> > But Zend Studio's Code completion is not working for this type of
> > object, Any hints?
> >
> Zareef,
> In Zend Studio 4.0 (not sure about earlier versions) you can use a
> "class type hint" to let the editor know what type of object you are
> working with. This is especially useful when you are using factory
> methods to create objects (as I often do with PEAR DataObjects) or have
> a setup similar to the above. The documentation for this in the studio
> distribution appears to be broken because it says something like "See
> below for example" but there is actually no example (I filed a bug with
> Zend about this). Butm, if you dig through he "Quick Tips" you can find
> the example which is where I first came across it.
> 
> Here's how I use it for DataObjects:
> --
> $user_obj =& DB_DataObject::factory('User');
> /* @var $user_obj DataObjects_User */
> $user_obj->youShouldHaveCodeCompletionNowForThisObject();
> --
> 
> In your example it would be something like:
> --
> $user_obj = LoadClass('user');
> /* @var $user_obj user */
> $user_obj->youShouldHaveCodeCompletionNowForThisObject();
> --

Yes Jamie  It works.
Thanks a lot 

zareef ahmed 
> 
> You'll need to make sure that Zend Studio knows to look through the file
> that contains the class that you are dynamically loading. I think you
> can do this if your code is withint a "project" and you specify it with
> "Add to Project".
> 
> - Jamie
> 
> 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] Classes code completion and Zend Studio

2005-03-14 Thread Zareef Ahmed
On Mon, 14 Mar 2005 09:03:00 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> 
wrote:
> 
> > Hi All,
> >
> >  I have a function to load the classes and return the object.
> >
> > function LoadClass($ClassName)
> > {
> > require_once("Class.$ClassName.inc");
> > return new $ClassName();
> > }
> >
> > Its working fine.
> >
> > But Zend Studio's Code completion is not working for this type of
> > object, Any hints?
> 
> You could file a bug report with Zend for starters.
> 
> In the meantime, you could *maybe* set things up so that in your
> development environment, you load all the classes with a static
> "require_once" and then the class definitions will be there.
> 
>if ($DEVELOPMENT_SERVER){
> require_once "Class.foo.inc";
> require_once "Class.bar.inc";
>   }
> ?>
> 
> It will slow things down a bit, loading classes you don't need, but
> hopefully Zend Studio will pick up on all the classes that way.
Yes Zend Studio works fine in this way. Actually function was created
to load only needed classes at run time  a PHP4 version of  PHP5's 
__autoload function.

zareef ahmed

> 
> --
> Like Music?
> http://l-i-e.com/artists.htm
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

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



Re: [PHP] PHP causes Apache segmentation fault?

2005-03-14 Thread Richard Lynch
> PHP I'm already building from Source. Uninstalling all of MySQL doesn't
> seem to be an option because of that dovecot dependency.
>
> What I'd really like to know (among so many other things) is how
> configure is determining which MySQL it should use. Also knowing the
> difference between PHP via a browser (via apache) and PHP on the command
> line would give me some clues. I don't understand why the client API
> version for mysqli is different according to how PHP is accessed.

Suppose, just for the sake of argument, that your Apache had
mod_auth_mysql compiled into it.

Also suppose, for the sake of argument, that it was on version MySQL 3
when you did that.

When you try to compile PHP, it *CANNOT* use MySQL 4 in the PHP Module, or
Apache's mod_auth_mysql would get all fargled up.

The CLI version, however, does not have that constraint.

*MAYBE* configure is smart enough to figure this kind of stuff out, and
that's why you got what you got.

More likely, you've still got MySQL 3 installed somewhere on your system.

If you're not willing to un-install that, and configure isn't finding the
version you want to use, then start reading/hacking the Makefiles that
configure builds.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP causes Apache segmentation fault?

2005-03-14 Thread John Swartzentruber
On 3/14/2005 12:22 PM Richard Lynch wrote:
When I run phpinfo(), it says my mysqli API client version is 3.23.58.
When I run "php -i" from the command line it says it is 4.1.10a. The
latter is correct. What would cause the discrepancy? The server has been
stopped and started many times, and PHP rebuilt a few times, so it isn't
a browser buffer issue.

Well, you've identified your problem.
Your RPMs are all screwed up (no surprise there) and the PHP_MySQL Module
is on version 3.23.58 but you are actually running MySQL 4.1.10a
Where does the PHP_MySQL Module come from? Is that part of PHP or MySQL? 
I would think that it is from PHP and would be built when I build PHP. I 
have --with-mysqli pointing to a version of mysql_config that has the 
correct version.


Most likely, you didn't UNINSTALL the previous version of MySQL before you
installed PHP at some point.
I uninstalled all of the MySQL RPMs except for the shared libraries, 
which I upgraded. The problem with uninstalling that one is that there 
is a dependency in dovecot and I don't want to uninstall my mail system.


You'll have to either switch to building from source, so you actually know
what's going on, or un-install everything (PHP, MySQL, etc) and then
re-install and hope the RPM maintainers have things right.
PHP I'm already building from Source. Uninstalling all of MySQL doesn't 
seem to be an option because of that dovecot dependency.

What I'd really like to know (among so many other things) is how 
configure is determining which MySQL it should use. Also knowing the 
difference between PHP via a browser (via apache) and PHP on the command 
line would give me some clues. I don't understand why the client API 
version for mysqli is different according to how PHP is accessed.

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


[PHP] Referencing different static members in

2005-03-14 Thread André Pletschette
Hi,
In the static function "toHtml_table_heading" I want to use a static 
array $fields, which is defined differently in each implementation.

My first trial was to use  self::$fields[]   to access this array, but 
this only sees the member of DBTable, not the inherited from DBTable.

My second trial was to pass the classnmae thru $classname and to access 
the correct $fields with $classname::$fields, but that doesn't seem to work.


abstract class DBTable  {
   static protected $fields = array();
   static function  toHtml_table_heading($classname) {
   $fields = $classname::$fields;  // <== syntax error, unexpected 
T_PAAMAYIM_NEKUDOTAYIM
  //...
   }
   //...
}

class DBImplementation extends DBTable {
  public function intializeClass() {
 self::$fields[] = new Object(1);
 self::$fields[] = new Object(2);
  }
  function __construct() {
 intializeClass()
  } 
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] REMOTE_ADDR

2005-03-14 Thread Rasmus Lerdorf
Richard Lynch wrote:
I am running PHP 5 on a Apache platform (Mac) and I have just noticed
that the log I keep of ip's entering my site, is showing the internal
server ip instead of the external visitor ip.
I am using getenv("REMOTE_ADDR") and is has been working before.

Try $_SERVER['REMOTE_ADDR'] instead of getenv()
getenv() is actually the more portable way to do this since there is no 
guarantee that $_SERVER is enabled.

Not sure it will be different, but it's what I use...
It won't be.  getenv() first checks the server environment and if it 
doesn't find the value there it checks the underlying real environment.

If getenv() doesn't find it, $_SERVER definitely won't either.  This is 
a var set by the web server, so if it is missing, look at the web server 
for the problem.

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


Re: [PHP] incrementing a number from a text file

2005-03-14 Thread Richard Lynch
>> Select blablabla FROM t1,t2,t3
>> WHERE customers LIKE '%$s%'
>> OR name LIKE '%$s%'
>> OR domain LIKE '%$s%'
>> OR email LIKE '%$s%'
>> OR log LIKE '%$s%'
>> AND t1.id = t2.t1_id
>> AND t1.id = t3.t1_id
>>
>> Horror!
>>
>
> Perhaps I'm missing something, but what's wrong with that query? It
> looks like a pretty normal search query to me. If you need to search
> through a bunch of records for various text fragments, and you're not
> certain which field they're in, why *wouldn't* you use a query like
> this?

Been there.  Done that.

Because of operator precedence, this turns into:

customers like '%$s%' or name like '%$s%' or domain like '%$s%' or email
like '%$s%' or (log like '%$s%' and t1.id = t2.t1_id and t1.id = t3.t1_id)

So you basically end up with the cartesian product of three tables for
most of the tests, and the foreign keys only kick in for the log test.

Assuming the three tables have reasonable amounts of data in them, you
then are checking count(t1) * count(t2) * count(t3) tuples with LIKE on
text fields.

This should quickly bring the database server to its knees. :-)

I'd be surprised if this kind of thing survived even the worst QA -- You'd
have to have hefty db server, and very small tables and VERY BAD QA to not
notice something was wrong.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Eliminating CLI overhead

2005-03-14 Thread Richard Lynch
> I intend to run a lot of PHP scripts, all the time, on a Linux machine.
> The scripts were designed for CLI environment, since they will handle
> the entire management of the machine, being started by init and then
> effectively and completely taking over.
>
> I'm wondering whether starting up the PHP interpreter for every script
> hurts performance, if there's anything I can do about it, and if possible,
> would the potential gain be noticeable? We're talking a machine in the
> range of 1 GHz CPU speed, with IDE disk drives. I've already considered
> all kinds of Linux-specific "tricks", I'm interested in the pure PHP
> aspect of the issue.

You'll want to build your PHP binary lean and mean, of course, including
only the Modules you *need* for those scripts to run.

If there is some HUGE module that you need only rarely, and only for one
script, you could even compile two binaries, and only use the fat one when
you need it.

I suspect, though, that the OS will cache all of PHP binary for the most
part, and you're needlessly worrying, instead of testing/benchmarking.

Try it and see.

If all that doesn't work...

I suppose you could create a PHP script with an endless loop in it,
reading from some socket or STDIN, and which does an http://php.net/eval
on the data given to it...  I really doubt that this is a Good Idea, much
less that you need it in the first place.  Could be fun to try it, though.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Mailing List

2005-03-14 Thread Richard Lynch
> A form with a rich text box and a submit button.

I've got not idea what a rich text box is, so you're on your own for that
part.

> Then someone suggested urlencode however that encoded the entire message,
> so
> they got Click%20the%20link%20below..

You want to use urlencode, but *only* on the filename part.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP causes Apache segmentation fault?

2005-03-14 Thread Richard Lynch
> When I run phpinfo(), it says my mysqli API client version is 3.23.58.
> When I run "php -i" from the command line it says it is 4.1.10a. The
> latter is correct. What would cause the discrepancy? The server has been
> stopped and started many times, and PHP rebuilt a few times, so it isn't
> a browser buffer issue.

Well, you've identified your problem.

Your RPMs are all screwed up (no surprise there) and the PHP_MySQL Module
is on version 3.23.58 but you are actually running MySQL 4.1.10a

Most likely, you didn't UNINSTALL the previous version of MySQL before you
installed PHP at some point.

You'll have to either switch to building from source, so you actually know
what's going on, or un-install everything (PHP, MySQL, etc) and then
re-install and hope the RPM maintainers have things right.

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



Re: [PHP] newbie:changing variable to type resource

2005-03-14 Thread Richard Lynch
> I am new to PHP, stuck with a problem and need your help.
>
> I would like to change a variable to type resource.
> I searched in php.net and in google but did not find anything helpful.
>
> Now , why I would like to do that...
>
> I am writing a socket application which will accept connection from
> browser,receive data and write the data sent by browser into another
> open socket.Receive data from the open socket and write it back to the
> browser.
>
> When there are more than one client(browser) connecting to my program
> ,I am saving the connection information (socket ID)for browser
> connections in a plain text file.
>
> I intend to retrive the socket ID information and do a
> socket_write(..) with socket ID as the first parameter, but I am
> getting an error that I cant convert any type to a resource type. Is
> there any workaround ??
>
> Is it going to help me if I use session information ?
>
> I am not using apache.
>
> I may be wrongly designing the program.

The design just maybe might be fine in theory, but in practice...

A socket connection can't be shared across PHP instances, I don't think.

Certainly not by writing the resource into a text file.

You *MIGHT* be able to write the resource into shared memory
http://php.net/shmop but I doubt that will work at all, and even if it
does, having two programs reading/writing the same socket resource at one
time sounds like a recipie for disaster.

Why do you want to share this socket across two PHP programs?

What exactly are you doing?

I suspect that the design is not right, even in theory, but can't be sure.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] password Boxes

2005-03-14 Thread Richard Lynch
> Does anyone know how to change the style of password boxes so when the
> characters are entered an asterisk appears rather that a smal circle?
>
> Or is this just determed by the OS and uncangable with CSS or Javascript
> of
> PHP?

They are certainly NOT changeable with PHP.

I doubt that JavaScript holds the answer either.

You might, however, find an HTML ATTRIBUTE supported by some browsers that
allows you to change the character used.  I doubt it, but it's possible.

If it is possible, presumably CSS allows you to change the attribute as
well, though you never know for sure with CSS...

For sure, whatever you do find, it ain't something that's standard across
all browsers.  But you may only care about the one browser that uses the
small circles anyway.

Why in the world do you WANT to change it? [puzzled]

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Classes code completion and Zend Studio

2005-03-14 Thread Richard Lynch

> Hi All,
>
>  I have a function to load the classes and return the object.
>
> function LoadClass($ClassName)
> {
> require_once("Class.$ClassName.inc");
> return new $ClassName();
> }
>
> Its working fine.
>
> But Zend Studio's Code completion is not working for this type of
> object, Any hints?

You could file a bug report with Zend for starters.

In the meantime, you could *maybe* set things up so that in your
development environment, you load all the classes with a static
"require_once" and then the class definitions will be there.



It will slow things down a bit, loading classes you don't need, but
hopefully Zend Studio will pick up on all the classes that way.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] REMOTE_ADDR

2005-03-14 Thread Richard Lynch
> I am running PHP 5 on a Apache platform (Mac) and I have just noticed
> that the log I keep of ip's entering my site, is showing the internal
> server ip instead of the external visitor ip.
>
> I am using getenv("REMOTE_ADDR") and is has been working before.

Try $_SERVER['REMOTE_ADDR'] instead of getenv()

Not sure it will be different, but it's what I use...

It's possible your httpd.conf User is [re-]setting the environment
variable REMOTE_ADDR -- which may or may not be how Apache transmits that
to PHP -- I dunno, really.

If that doesn't help, perhaps  will help you sort out
what's what.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: [PHP-DEV] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled

2005-03-14 Thread Edin Kadribasic
Windows binaries are now available at:

PHP 5.0.4RC1
http://downloads.php.net/edink/php-5.0.4RC1-Win32.zip

PHP 4.3.11RC1
http://downloads.php.net/edink/php-4.3.11RC1-Win32.zip

Additional downloads for PHP 5.0.4RC1:
http://downloads.php.net/edink/pecl-5.0.4RC1-Win32.zip
http://downloads.php.net/edink/php-debug-pack-5.0.4RC1-Win32.zip

Edin

- Original Message - 
From: "Zeev Suraski" <[EMAIL PROTECTED]>
To: ; 
Sent: Monday, March 14, 2005 11:13 AM
Subject: [PHP-DEV] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled


> Everyone,
>
> We've rolled initial release candidates for PHP 5.0.4 and 4.3.11. As
usual,
> these 3rd digit releases include a variety of bug fixes and minor updates.
>
> PHP 5.0.4RC1 source:
> http://downloads.php.net/zeev/php-5.0.4RC1.tar.bz2
> http://downloads.php.net/zeev/php-5.0.4RC1.tar.gz
>
> PHP 4.3.11RC1 source:
> http://downloads.php.net/ilia/php-4.3.11RC1.tar.bz2
> http://downloads.php.net/ilia/php-4.3.11RC1.tar.gz
>
> Windows binaries will be posted and announced soon.
>
> Changes in PHP 5.0.4RC1:
http://cvs.php.net/co.php/php-src/NEWS?r=1.1760.2.286
> Changes in PHP 4.3.11RC1:
http://cvs.php.net/co.php/php-src/NEWS?r=1.1247.2.854
>
> Any help in testing these release candidates would be appreciated!
>
> Zeev
>
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

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



[PHP] Migration from php4 to php 5 open_basedir directive.

2005-03-14 Thread Craig Lewis
Hello,
I have just attempted to migrate for the first time from  php4 to php5. 
The problem i am having is some sort of change in how the open_basedir 
directive works in php 5. I don't see much discussion about this, so I 
must be doing something stupid, otherwise, I would think there would be 
a lot of people bumping into this.

On both servers I have safe mode on and open_basedir directive set for 
the virtual host in apache. The offending php code from the top level 
file calls another php file with require_once ('path/file.php') and then 
file.php in turn calls another php file require_once ('path/file2'). Its 
this second require_once that causes the fatal  error, in otherwords, I 
can call the first file with require_once, and put just about any sort 
of reasonable php code in this file, and it works, i.e. its included in 
the origional file. When the called file, calls another file, in php 5, 
I get an error,

==
Warning: main() [function.main]: open_basedir restriction in effect. 
File(/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php) is 
not within the allowed path(s): (/www/htdocs/midwifefinder.com/site) in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Warning: main(config/_config.inc.php) [function.main]: failed to open 
stream: Operation not permitted in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3

Fatal error: main() [function.require]: Failed opening required 
'config/_config.inc.php' 
(include_path='.:/usr/local/pkg/php/php-5.0.2//lib/php') in 
/www/htdocs/midwifefinder.com/site/includes/app.php on line 3


The code and paths are unchanged, works on php4, not on php5, apache  
version unchanged. (1.3.x). I have tried various php.ini files, of 
course turning open_basedir off will make the error go away. The file 
being called is clearly within the scope of the open_basedir 
restriction, and thus it works just fine in php4.

/usr/local/pkg/php/php-5.0.2//lib/php/config/_config.inc.php is not the 
correct path to the file, I guess because it doesn't find the file in 
the . (dot) part of the include path, then it blows up when it tries to 
find the file in (what is basically) /usr/local/lib/php.

This kind of sounds like a TRANSPATH related problem, and its certainly 
a path problem (where is dot), but as I read the docs, TRANSPATH is 
something that changed for apache 2.

Any advice would be appreciated.
CL
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP5 & JBOSS

2005-03-14 Thread Jason Barnett
David Joffrin wrote:
> Hi,
>
> I searched on the net, found a lot of articles about it... followed all
> the various one by one, tried a lot, but I am getting the famous error:
> java.lang.UnsatisfiedLinkError: no php5servlet.dll in java.library.path.
>
...
>
> I modified my application to display the java.librara.path which lists
> (of course) c:/windows/system32 path.
>
> However, I am having the message just listed above.
>
> Any clue?

I've never used JBOSS... but it's possible that php5servlet.dll is
linking to *another* php library which is not located in your path.
Check to see if there are any extensions which are supposed to be loaded
and if those libraries are available.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: inserting arabic into mysql

2005-03-14 Thread Christophe Chisogne
Jason Barnett a Ãcrit :
trying to store data in MySQL in an unsupported encoding format.
MySQL only supports the UTF-8 encoding (of Unicode) since MySQL 4.1 IIRC
Ch.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] password Boxes

2005-03-14 Thread trlists
On 14 Mar 2005 Dotan Cohen wrote:

> change
> 
> 
> To:
> 

This does not address the question.  The OP saw small dots in the 
password display, he wanted asterisks.   That is not because he was 
using type='text' but because he was already using type='password' and 
the browser had a particular way of displaying characters in such 
fields, which he wanted to change.

> This is an HTML related question, not php (or even javascript). Next
> time try google. 

Really it is a browser implementation question, not even HTML. But in 
any case, I am not the person who asked the question.  You may want to 
direct your advice to them.

People get confused all the time about what is happening on the server 
side and what is on the client side.  This poster asked specifically 
whether the issue could be addressed in PHP or was (in his terms) an 
"OS issue".  I don't think knowing the answer to that question is a 
prerequisite for posting here.

--
Tom

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



Re: [PHP] password Boxes

2005-03-14 Thread Jochem Maas
Dotan Cohen wrote:
On Mon, 14 Mar 2005 08:37:04 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
On 14 Mar 2005 Ross Hulford wrote:

Does anyone know how to change the style of password boxes so when
the characters are entered an asterisk appears rather that a smal
circle?
It is determined by the browser and OS.  I presume you are talking
about Windows XP, which is where I see that behavior.  You might try
use a CSS entry or "style=" to change the font for the input box to
Courier and see if it behaves differently.
--
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

change

To:

This is an HTML related question, not php (or even javascript). Next
time try google.
yeah ... but next time read the question before you answer ;-)
the guy was wondering how to change which character was used as
the mask in password fields - normally its an asterisk, if
you use WinXP with the std. wibbly-wobbly-blue-bubble-wrap theme
it shows a small (filled) circle instead... earth-shattering.
:-)
Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: eregi expression for checking a domain

2005-03-14 Thread Jason Barnett
Ross Hulford wrote:
> Does anyone know a working eregi expression for determining a domain is
> valid? don't need the http:// just looking for www.thedomain.com
>
> cheers,
>
>
> R.

parse_url()

http://php.net/manual/en/function.parse-url.php

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: inserting arabic into mysql

2005-03-14 Thread Jason Barnett
P80 wrote:
> I have a text area form and when I insert it into mysql I get letters like 
> this:
> Ã"ÃÅÃÂÃÂÃâÃ"ÃâÃâÃÂÃÅÃÂÃ" ÃâÃÅÃÂÃ"
> ÃÂÃÅ 
> Ã"ÃÂÃÂÃÅ...
> instead of arabic letters. anything I know do to get it right?
> 
> thanx in advance

You're definitely better off asking this question on a MySQL list... or
possibly even the php-db list.  My uneducated guess is that you're
trying to store data in MySQL in an unsupported encoding format.  I am
not sure how to fix that problem though, just throwing out an answer
since no else has responded to this thread yet.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins



signature.asc
Description: OpenPGP digital signature


[PHP] Re: Eliminating CLI overhead

2005-03-14 Thread Jason Barnett
Skippy wrote:
> I intend to run a lot of PHP scripts, all the time, on a Linux machine.
> The scripts were designed for CLI environment, since they will handle
> the entire management of the machine, being started by init and then
> effectively and completely taking over.
>
> I'm wondering whether starting up the PHP interpreter for every script
> hurts performance, if there's anything I can do about it, and if possible,
> would the potential gain be noticeable? We're talking a machine in the
> range of 1 GHz CPU speed, with IDE disk drives. I've already considered
> all kinds of Linux-specific "tricks", I'm interested in the pure PHP
> aspect of the issue.
>

If you want to reduce startup overhead then you could just run PHP as a
shared Apache module.  You will save the time required for the MINIT
hooks... not sure how much time you'll end up saving, but you should
notice the difference.  This would be especially true if you have a lot
of extensions compiled into PHP.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] password Boxes

2005-03-14 Thread Dotan Cohen
On Mon, 14 Mar 2005 08:37:04 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> On 14 Mar 2005 Ross Hulford wrote:
> 
> > Does anyone know how to change the style of password boxes so when
> > the characters are entered an asterisk appears rather that a smal
> > circle?
> 
> It is determined by the browser and OS.  I presume you are talking
> about Windows XP, which is where I see that behavior.  You might try
> use a CSS entry or "style=" to change the font for the input box to
> Courier and see if it behaves differently.
> 
> --
> Tom
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
change


To:


This is an HTML related question, not php (or even javascript). Next
time try google.

Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com

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



[PHP] REMOTE_ADDR

2005-03-14 Thread Niels Riis Kristensen
Hi
As a relative newbie I have a problem:
I am running PHP 5 on a Apache platform (Mac) and I have just noticed 
that the log I keep of ip's entering my site, is showing the internal 
server ip instead of the external visitor ip.

I am using getenv("REMOTE_ADDR") and is has been working before.
Can anyone help?

Med venlig hilsen
Niels Riis Kristensen
-
NRK Gruppen
- Elektronisk nodeengravering
- Webhotel
- Webdesign
- Udøvende musik
---
Send penge sikkert over Internettet!
Klik her: https://www.paypal.com/refer/pal=EAJLSE5TQELFC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Classes code completion and Zend Studio

2005-03-14 Thread Zareef Ahmed
Hi All,

 I have a function to load the classes and return the object.

function LoadClass($ClassName)
{
require_once("Class.$ClassName.inc");
return new $ClassName();
}

Its working fine.

But Zend Studio's Code completion is not working for this type of
object, Any hints?



Zareef Ahmed

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



Re: [PHP] password Boxes

2005-03-14 Thread trlists
On 14 Mar 2005 Ross Hulford wrote:

> Does anyone know how to change the style of password boxes so when
> the characters are entered an asterisk appears rather that a smal
> circle? 

It is determined by the browser and OS.  I presume you are talking 
about Windows XP, which is where I see that behavior.  You might try 
use a CSS entry or "style=" to change the font for the input box to 
Courier and see if it behaves differently.


--
Tom

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



Re: [PHP] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled

2005-03-14 Thread Evert | Rooftop Solutions
Zeev Suraski wrote:
Everyone,
We've rolled initial release candidates for PHP 5.0.4 and 4.3.11. As 
usual, these 3rd digit releases include a variety of bug fixes and 
minor updates.

PHP 5.0.4RC1 source:
http://downloads.php.net/zeev/php-5.0.4RC1.tar.bz2
http://downloads.php.net/zeev/php-5.0.4RC1.tar.gz
PHP 4.3.11RC1 source:
http://downloads.php.net/ilia/php-4.3.11RC1.tar.bz2
http://downloads.php.net/ilia/php-4.3.11RC1.tar.gz
Windows binaries will be posted and announced soon.
Changes in PHP 5.0.4RC1: 
http://cvs.php.net/co.php/php-src/NEWS?r=1.1760.2.286
Changes in PHP 4.3.11RC1: 
http://cvs.php.net/co.php/php-src/NEWS?r=1.1247.2.854

Any help in testing these release candidates would be appreciated!
Zeev
Is there a roadmap available for PHP? I have to wait for the final 
release to put it live, And I've been waiting for .11 for a while. It 
would be nice if there's a way to check when the next version is 
expected to be released.

Thanx for your great work,
Evert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] password Boxes

2005-03-14 Thread Ross Hulford
Does anyone know how to change the style of password boxes so when the 
characters are entered an asterisk appears rather that a smal circle?

Or is this just determed by the OS and uncangable with CSS or Javascript of 
PHP?


R. 

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



[PHP] newbie:changing variable to type resource

2005-03-14 Thread Saswat Praharaj
Hi All,

I am new to PHP, stuck with a problem and need your help.

I would like to change a variable to type resource.
I searched in php.net and in google but did not find anything helpful.

Now , why I would like to do that...

I am writing a socket application which will accept connection from
browser,receive data and write the data sent by browser into another
open socket.Receive data from the open socket and write it back to the
browser.

When there are more than one client(browser) connecting to my program
,I am saving the connection information (socket ID)for browser
connections in a plain text file.

I intend to retrive the socket ID information and do a
socket_write(..) with socket ID as the first parameter, but I am
getting an error that I cant convert any type to a resource type. Is
there any workaround ??

Is it going to help me if I use session information ?

I am not using apache.

I may be wrongly designing the program.

Would appreciate all your suggestion and help.

Thanks,
-Saswat

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



Re: [PHP] PHP causes Apache segmentation fault?

2005-03-14 Thread John Swartzentruber
On 3/14/2005 6:03 AM Burhan Khalid wrote:
John Swartzentruber wrote:
When I run phpinfo(), it says my mysqli API client version is 3.23.58. 
When I run "php -i" from the command line it says it is 4.1.10a. The 
latter is correct. What would cause the discrepancy? The server has 
been stopped and started many times, and PHP rebuilt a few times, so 
it isn't a browser buffer issue.

For the love of all that is holy, please don't send repeat messages to 
the list!!
I didn't. I have no idea why that came through twice. Believe me, it 
annoyed me more than it annoyed you. Or are you saying I should not have 
replied to myself to provide the additional information? When I 
discovered that, it seemed significant in terms of tracking down the 
problem, so I didn't see any reason to wait to provide it. I've been 
trying to track down these problems off and on for a couple months and 
I'm growing impatient (not with you or other people trying to help me, 
just in general).


Are you sure you built both the client and the server module versions? 
It seems only your cli build is using the new API.
Built both client and server module versions of what? I installed MySQL 
from RPMs, and installed all of the available packages (client, server, 
devel, libraries, bench). PHP, I built using a slightly modified version 
of the options that were in the version 4 RPM. My settings are available 
at http://john.swartzentruber.us/test.php. I'm currently running 
5.04-dev because I ran the most recent stable CVS version before 
reporting the bug.

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


Re: [PHP] PHP causes Apache segmentation fault?

2005-03-14 Thread Burhan Khalid
John Swartzentruber wrote:
On 3/13/2005 3:55 PM John Swartzentruber wrote:
On 3/11/2005 11:57 AM John Swartzentruber wrote:
I am running Fedora core3 with Apache 2.0.52 (from default RPMs), 
MySQL 4.1.10 (from RPMs from MySQL site), and PHP 5.0.3 built from 
source.

I'm going through the PHP manual and trying some of the mysqli 
examples. The last one I tried didn't work. The problem appears to 
be this line:

$row = $result->fetch_array(MYSQLI_ASSOC);
Using MYSQLI_BOTH also fails, and MYSQLI_NUM works.
This is what is in my httpd error log:
[Thu Mar 10 17:07:06 2005] [notice] child pid 29903 exit signal 
Segmentation fault (11)

I've reported this as a PHP bug and then continued to do some more 
research. What I'm finding is very odd.

When I run this script under apache, it appears that there is a clash 
between the structures used in a MySQL library and what is in the 
mysql.h header file. When I do a phpinfo(), it says that my mysqli 
client API version is "3.23.58". That seems wrong. I have MySQL 
4.1.10a installed. This version difference *could* explain the 
difference, but I have no idea why it would be using the old version. 
The libmysql libraries and programs are all dated March 9, 2005 or 
later. The --with-mysqli configure parameter points to a mysql_config 
program with that date. Why would it think it was using an older API?

Another very weird thing is that when I run the script directly from 
the command line, the structure looks good and has all of the correct 
(i.e., expected) values. What is different about running PHP from the 
command line and from Apache that would cause it to use different 
MySQL structures?

Sorry to reply to myself, but here's the succinct question:
When I run phpinfo(), it says my mysqli API client version is 3.23.58. 
When I run "php -i" from the command line it says it is 4.1.10a. The 
latter is correct. What would cause the discrepancy? The server has been 
stopped and started many times, and PHP rebuilt a few times, so it isn't 
a browser buffer issue.
For the love of all that is holy, please don't send repeat messages to 
the list!!

Are you sure you built both the client and the server module versions? 
It seems only your cli build is using the new API.

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


[PHP] PHP 5.0.4RC1 and PHP 4.3.11RC1 rolled

2005-03-14 Thread Zeev Suraski
Everyone,
We've rolled initial release candidates for PHP 5.0.4 and 4.3.11. As usual, 
these 3rd digit releases include a variety of bug fixes and minor updates.

PHP 5.0.4RC1 source:
http://downloads.php.net/zeev/php-5.0.4RC1.tar.bz2
http://downloads.php.net/zeev/php-5.0.4RC1.tar.gz
PHP 4.3.11RC1 source:
http://downloads.php.net/ilia/php-4.3.11RC1.tar.bz2
http://downloads.php.net/ilia/php-4.3.11RC1.tar.gz
Windows binaries will be posted and announced soon.
Changes in PHP 5.0.4RC1: http://cvs.php.net/co.php/php-src/NEWS?r=1.1760.2.286
Changes in PHP 4.3.11RC1: http://cvs.php.net/co.php/php-src/NEWS?r=1.1247.2.854
Any help in testing these release candidates would be appreciated!
Zeev
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Building PHP5 on Windows - VS.net?

2005-03-14 Thread M. Sokolewicz
you'll get various problems on the way. Building php without any 
extensions is fairly easy, and doesn't pose any problems. However once 
you start compiling in extensions, you'll need to fiddle a bit with some 
(eg. pdo_mysql requires a couple of changes in the include paths in the 
c-files, icov extensions exports a symbol that doesn't actually exist, 
etc). Most of these are fairly simple to overcome though :)

-tul
Jim Plush wrote:
do you happen to remember what issues you may have had?
thanks again
[EMAIL PROTECTED] wrote:
Jim,
   i had only minor issues, but it builds fine otherwise.
"Jim Plush" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Has anyone successfully built php5 using visual studio.net ? or is 
VC6 still only supported?

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


[PHP] 64-bit PHP

2005-03-14 Thread Abdul Rehman Gani
Hi,
I am experiencing memory leaks when running a Mambo site on an AMD 64. 
This exact site ran fine on a 32-bit platform. Does anyone have 
experience with PHP on 64-bit platform? If so do you have any pointers 
for me?

Thanks,
Abdul
East Coast Access
Tel: 031-566-8080
Fax: 031-566-8010
Web: http://www.eastcoast.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] IMAP with ssl support

2005-03-14 Thread Bostjan Skufca @ domenca.com
For Imapd:

make slx &&
cp imapd/imapd /usr/local/sbin/ &&

cd c-client &&
cp c-client.a /usr/local/lib/libc-client.a &&
cp rfc822.h /usr/local/include/ &&
cp mail.h /usr/local/include/ &&
cp linkage.h /usr/local/include/



For PHP:
add just '--with-imap' '--with-imap-ssl'


regards,
Bostjan



On Friday 11 March 2005 21:11, Bronislav Klucka wrote:
> Hi,
> I'm trying to compile php with imap ssl support, I've downloaded imap
> source and run
>
> make lnp SSLTYPE=unix
>
> then i run php configure file with
>
> as
>
> ./configure --with-imap=/usr/src/php5/imap/ --with-openssl
> --with-imap-ssl=/usr/src/php5/imap/
>
> configuration, make and make install worked but I there is still no
> imaps support...
>
> what am I doing wrong?
>
>
> Brona

-- 
Best regards,

Bostjan Skufca
system administrator

Domenca d.o.o. 
Phone: +386 4 5835444
Fax: +386 4 5831999
http://www.domenca.com

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



Re: [PHP] PHP Frameworks

2005-03-14 Thread Burhan Khalid
Simon Reye wrote:
I'm moving away from Cold Fusion and am considering java or php.  I've 
mucked around with Struts and Coccoon on the java side and think they 
are great.  There does not however seem to be any well backed projects 
similar to these for php.

Can anyone point me to a good php MVC framework?
Haven't used it personally, but looks promising 
http://phrame.sourceforge.net/

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