Re: [PHP] Name in HTML input

2006-07-18 Thread weetat

Hi ,

 Thanks for your info.
 I am new in PHP , how to remove the the space and '(',')' ?

Thanks



Sameer N Ingole wrote:

Sameer N Ingole wrote:


weetat wrote:



 value="FHK0924F0JG (2771890816)">


Space in name. Remove it.


oh, also remove '(' and ')' then check.



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



Re: [PHP] Name in HTML input

2006-07-18 Thread nicolas figaro

weetat a écrit :

Hi ,

 Thanks for your info.
 I am new in PHP , how to remove the the space and '(',')' ?


hi,
$newstring = str_replace(" ","_",$string);
$newstring = str_replace(",","_",$newstring)

hope this'll help

N F

Thanks



Sameer N Ingole wrote:

Sameer N Ingole wrote:


weetat wrote:



 value="FHK0924F0JG (2771890816)">


Space in name. Remove it.


oh, also remove '(' and ')' then check.






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

RE: [PHP] GD to database directly

2006-07-18 Thread Jay Blanchard
[snip]
Kevin, you have more than once pointed out using a RAW format for
operating the data system, what exactly do you mean? The database
becomes the OS? If so, how do you set that up? It is something that I am
not totally familiar with. 
[/snip]

I did some research and went back to Kevin's original statement;

[kevin]
databases can be stored on RAW partitions, thus eliminating FILE SYSTEM
overhead
[/kevin]

Here is what I found;

[quote]
raw partition vs filesystem store? 

> What are pros/cons as far as performance, reliability, and ease of 
> backup/restore? 
> 
> Anyone have any experience running Innodb on raw partition? 

raw partitions are beneficial only in some old OS/hardware
configurations 
where fsync is extremely slow. In most computers, you only get a < 5 % 
performance improvement from raw partitions. 

> Any thoughts as to best filesystem for Innodb? What about pros/cons of

> journaled filesystems when in use with Innodb (i.e. transactions)? 

All major Linux file systems seem to have almost the same performance. 
[/quote - Heikki Tuuri]

Use of MySQL on a RAW partition I limited to InnoDB type; (note the use
of 'may' in the quote)

[quote]
http://dev.mysql.com/doc/refman/5.0/en/innodb-raw-devices.html

"You can use raw disk partitions as data files in the shared tablespace.
By using a raw disk, you can perform non-buffered I/O on Windows and on
some Unix systems without filesystem overhead, which may improve
performance."
[/quote]

[quote]
A raw device can be bound to an existing block device (e.g. a disk) and
be used to perform "raw" IO with that existing block device. Such "raw"
IO bypasses the caching that is normally associated with block devices.
Hence a raw device offers a more "direct" route to the physical device
and allows an application more control over the timing of IO to that
physical device. This makes raw devices suitable for complex
applications like Database Management Systems that typically do their
own caching. 
[/quote - SCSI HOWTO]

Based on what I read utilizing a RAW would probably require most PHP'ers
to reconfigure their systems in major ways, including the database type,
disk partitions, etc. I don't know about you, but most would consider
Heikki Tuuri an expert on MySQL systems and Tuuri's thoughts indicate
that RAW partitions vs. file systems are a wash unless you have fsync
problems. It would appear that the only benefit comes from not having
the file system doing the caching.

[previous statement]
There are a lot of us using MySQL (and PostGreSQL) along with PHP and in
practice we have found that storing images in the database to be less
than ideal from both a performance and backup POV. The reasons range
from speed to overhead to ease of use. On our hardware. It not only has
to do with storing and retrieving BLOB data, but also things like
indexing, OS qwirks and the like.
[/previous statement]

I still stand by this, and amend by saying that using a RAW partition
for database storage is typically beyond the needs of most PHP'ers as it
gains nothing in performance and requires that much additional
maintenance be performed on the database as well as the OS for
maintenance of the RAW partition.

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



RE: [PHP] Name in HTML input

2006-07-18 Thread Jay Blanchard
[snip]
  Thanks for your info.
  I am new in PHP , how to remove the the space and '(',')' ?
[/snip]

Use the delete key.

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



Re: [PHP] Name in HTML input

2006-07-18 Thread Sameer N Ingole




 value="FHK0924F0JG (2771890816)">


Space in name. Remove it.


oh, also remove '(' and ')' then check.




This should be your second input tag.
value="FHK0924F0JG (2771890816)">


Read http://php.net/variables .. to know why it didn't work..

--
Sameer N. Ingole
http://weblogic.noroot.org/
---
Better to light one candle than to curse the darkness.

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



[PHP] Sort Array

2006-07-18 Thread weetat

Hi


I have the array below : How to sort the array by "Model" and "Country?

Thanks

array(

  "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
  "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
  "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
  "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
  "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),

)

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



RE: [PHP] Sort Array

2006-07-18 Thread Jay Blanchard
[snip]
I have the array below : How to sort the array by "Model" and "Country?

Thanks

array(

   "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
   "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
   "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
   "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
   "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),

)
[/snip]

http://www.php.net/manual/en/function.ksort.php

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



RE: [PHP] Sort Array

2006-07-18 Thread tg-php
Actually it's going to be a little more complicated than a 'ksort' here I think.

ksort on the main array is going to give you:

array (
   "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),
   "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
   "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
   "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
   "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234")
)

and ksort on the next leve down is going to sort the keys "Country" and "Model" 
so all the "Country" elements come before all the "Model" elements, which they 
already do.

I'm guessing what's being asked here is to be able to sort the "TBA" level (?) 
by the value of the "Model"s then by the value of the "Country"s.  So you'd end 
up with:

array (
   "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
   "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS1234"),
   "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
   "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),
   "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234")
)

(Changed Singapore's Model to match England's to illustrate Model then Country 
sorting)

If this is what the goal is, then it looks like the uasort() function might 
help.  Although I havn't messed with any of the usort() functions and on the 
surface they kind of bewilder me, but I believe that's what might help here.  
It does a user defined sort while maintaining index associations.

http://us3.php.net/manual/en/function.uasort.php

Hope that helps.

-TG





= = = Original message = = =

[snip]
I have the array below : How to sort the array by "Model" and "Country?

Thanks

array(

   "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
   "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
   "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
   "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
   "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),

)
[/snip]

http://www.php.net/manual/en/function.ksort.php


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Sort Array

2006-07-18 Thread Andrew Brampton

ksort won't do what he wants... Look at usort, and something like this:

function cmp($a, $b) 
{

  return strcmp($a['Country'], $b['Country']);
}

usort($array, "cmp");


Andrew

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>

To: "weetat" <[EMAIL PROTECTED]>; 
Sent: Tuesday, July 18, 2006 3:17 PM
Subject: RE: [PHP] Sort Array


[snip]
I have the array below : How to sort the array by "Model" and "Country?

Thanks

array(

  "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
  "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
  "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
  "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
  "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),

)
[/snip]

http://www.php.net/manual/en/function.ksort.php

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



Re: [PHP] Sort Array

2006-07-18 Thread Jochem Maas
Jay Blanchard wrote:
> [snip]
> I have the array below : How to sort the array by "Model" and "Country?
> 
> Thanks
> 
> array(
> 
>"TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
>"TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
>"TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
>"TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
>"TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),
> 
> )
> [/snip]
> 
> http://www.php.net/manual/en/function.ksort.php

you mean?:

http://php.net/manual/en/function.uasort.php



> 

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



RE: [PHP] Sort Array

2006-07-18 Thread Jay Blanchard
[snip]
Jay Blanchard wrote:
> [snip]
> I have the array below : How to sort the array by "Model" and
"Country?
> 
> Thanks
> 
> array(
> 
>"TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
>"TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
>"TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
>"TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
>"TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),
> 
> )
> [/snip]
> 
> http://www.php.net/manual/en/function.ksort.php

you mean?:

http://php.net/manual/en/function.uasort.php
[/snip]

That too. And RTFM.

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



Re: [PHP] Sort Array

2006-07-18 Thread Miles Thompson

At 10:51 AM 7/18/2006, weetat wrote:


Hi


I have the array below : How to sort the array by "Model" and "Country?

Thanks

array(

  "TBA0123456" => array("Country"=>"Singapore","Model"=>"WS8234"),
  "TBA0123458" => array("Country"=>"Indonesia","Model"=>"WS2234"),
  "TBA0123459" => array("Country"=>"Vietnam","Model"=>"WS7234"),
  "TBA0123452" => array("Country"=>"England","Model"=>"WS1234"),
  "TBA0123451" => array("Country"=>"Germany","Model"=>"WS6234"),

)


You do not way how the array is created.

If from a database, add " SORT by Model, Country " to your query and let 
the database do the work. Otherwise, read up on ar_multisort(), but I do 
not think you are going to find a built-in way of sorting one array on two 
indexes or key values.


Regards - Miles Thompson 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date: 7/17/2006

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



[PHP] pg_query and COPY in transaction

2006-07-18 Thread Luis Magaña
I have the following code:

pg_query($conn,"BEGIN TRANSACTION;
  DELETE FROM codigo_postal;
  COPY
codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
FROM '$tmpfname2' DELIMITER '|';
  COMMIT");

It is suppoused as I understand it, that if an error occurs on the copy
statement, then the codigo_postal table should still have all of the
previous records. Actually I've tested it within psql and it works as
expected.

However, the shown code does not. If an error occurs on the copy
transaction, the data on the table gets deleted.

I'm certainly lost on this one, is it a bug ?, am I doing something
wrong ? (most likely I guess)

Any help will be apprecciated.

PHP: 5.1.2
PostgreSQL: 8.1.4
Apache: 2.0.55
Debian Linux with Kernel 2.6.16


-- 
Luis Magaña
Gnovus Networks & Software
www.gnovus.com

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



Re: [PHP] pg_query and COPY in transaction

2006-07-18 Thread Jochem Maas
Luis Magaña wrote:
> I have the following code:
> 
> pg_query($conn,"BEGIN TRANSACTION;
>   DELETE FROM codigo_postal;
>   COPY
> codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
> FROM '$tmpfname2' DELIMITER '|';
>   COMMIT");
> 
> It is suppoused as I understand it, that if an error occurs on the copy
> statement, then the codigo_postal table should still have all of the
> previous records. Actually I've tested it within psql and it works as
> expected.
> 
> However, the shown code does not. If an error occurs on the copy
> transaction, the data on the table gets deleted.

wrapping an SQL question in a php function doesn't make it a php question. ;-)

$apps = array("apache", "mysql", "windows"); $i = 0;
while ($i++ < 100) printf("how do I install %s?\n", $apps[ rand(0,2) ]);

// I ran that code for a laugh a number of times - seems to a bias towards
// asking how to install windows... go figure on a php list.

> 
> I'm certainly lost on this one, is it a bug ?, am I doing something
> wrong ? (most likely I guess)

you are wrong. there is no ROLLBACK specified. I suggest you
do the queries one by one (i.e. one call to pg_query() for each statement)
and if the 'COPY' fails call a 'ROLLBACK'

disclaimer: I know nothing about PG as such - I mostly use Firebird;

> 
> Any help will be apprecciated.
> 
> PHP: 5.1.2
> PostgreSQL: 8.1.4
> Apache: 2.0.55
> Debian Linux with Kernel 2.6.16
> 
> 

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



Re: [PHP] pg_query and COPY in transaction

2006-07-18 Thread Luis Magaña
It is a PHP question because the Postgres querys do work, I ran them
directly on the postgres server and there is no problem, but if you use
pg_query then it does not work, and pg_query is a PHP function, is it no t?

Any way, I've tried already giving each query in separate function
calls, and it does not work either. As the rollback you suggest, I
haven't tried that since it is suppoused to be automatic. So I will try
that and it might work but that does not change the fact that the
pg_query function is not doing what the manual says it should do, or at
least does not beheave as expected.

thank you very much for your help.

regards.

Jochem Maas wrote:
> Luis Magaña wrote:
>> I have the following code:
>>
>> pg_query($conn,"BEGIN TRANSACTION;
>>   DELETE FROM codigo_postal;
>>   COPY
>> codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
>> FROM '$tmpfname2' DELIMITER '|';
>>   COMMIT");
>>
>> It is suppoused as I understand it, that if an error occurs on the copy
>> statement, then the codigo_postal table should still have all of the
>> previous records. Actually I've tested it within psql and it works as
>> expected.
>>
>> However, the shown code does not. If an error occurs on the copy
>> transaction, the data on the table gets deleted.
> 
> wrapping an SQL question in a php function doesn't make it a php question. ;-)
> 
> $apps = array("apache", "mysql", "windows"); $i = 0;
> while ($i++ < 100) printf("how do I install %s?\n", $apps[ rand(0,2) ]);
> 
> // I ran that code for a laugh a number of times - seems to a bias towards
> // asking how to install windows... go figure on a php list.
> 
>> I'm certainly lost on this one, is it a bug ?, am I doing something
>> wrong ? (most likely I guess)
> 
> you are wrong. there is no ROLLBACK specified. I suggest you
> do the queries one by one (i.e. one call to pg_query() for each statement)
> and if the 'COPY' fails call a 'ROLLBACK'
> 
> disclaimer: I know nothing about PG as such - I mostly use Firebird;
> 
>> Any help will be apprecciated.
>>
>> PHP: 5.1.2
>> PostgreSQL: 8.1.4
>> Apache: 2.0.55
>> Debian Linux with Kernel 2.6.16
>>
>>
> 

-- 
Luis Magaña
Gnovus Networks & Software
www.gnovus.com

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



Re: [PHP] pg_query and COPY in transaction

2006-07-18 Thread Jochem Maas
Luis Magaña wrote:
> It is a PHP question because the Postgres querys do work, I ran them
> directly on the postgres server and there is no problem, but if you use
> pg_query then it does not work, and pg_query is a PHP function, is it no t?
> 
> Any way, I've tried already giving each query in separate function
> calls, and it does not work either. As the rollback you suggest, I
> haven't tried that since it is suppoused to be automatic. So I will try
> that and it might work but that does not change the fact that the
> pg_query function is not doing what the manual says it should do, or at
> least does not beheave as expected.

so it seems that you _may_ have a bug. what version of php are you using?
and do pg_last_error() and/or pg_last_notice() offer any useful info?

(having read the pg_*() docs somewhat I can only - ouch! makes firebird
look even simpler than it is already)

I don't know what the COPY syntax in your SQL does exactly but have you looked
at pg_copy_from() and pg_copy_to() ?

> 
> thank you very much for your help.
> 
> regards.
> 
> Jochem Maas wrote:
>> Luis Magaña wrote:
>>> I have the following code:
>>>
>>> pg_query($conn,"BEGIN TRANSACTION;
>>>   DELETE FROM codigo_postal;
>>>   COPY
>>> codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
>>> FROM '$tmpfname2' DELIMITER '|';
>>>   COMMIT");
>>>
>>> It is suppoused as I understand it, that if an error occurs on the copy
>>> statement, then the codigo_postal table should still have all of the
>>> previous records. Actually I've tested it within psql and it works as
>>> expected.
>>>
>>> However, the shown code does not. If an error occurs on the copy
>>> transaction, the data on the table gets deleted.
>> wrapping an SQL question in a php function doesn't make it a php question. 
>> ;-)
>>
>> $apps = array("apache", "mysql", "windows"); $i = 0;
>> while ($i++ < 100) printf("how do I install %s?\n", $apps[ rand(0,2) ]);
>>
>> // I ran that code for a laugh a number of times - seems to a bias towards
>> // asking how to install windows... go figure on a php list.
>>
>>> I'm certainly lost on this one, is it a bug ?, am I doing something
>>> wrong ? (most likely I guess)
>> you are wrong. there is no ROLLBACK specified. I suggest you
>> do the queries one by one (i.e. one call to pg_query() for each statement)
>> and if the 'COPY' fails call a 'ROLLBACK'
>>
>> disclaimer: I know nothing about PG as such - I mostly use Firebird;
>>
>>> Any help will be apprecciated.
>>>
>>> PHP: 5.1.2
>>> PostgreSQL: 8.1.4
>>> Apache: 2.0.55
>>> Debian Linux with Kernel 2.6.16
>>>
>>>
> 

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



[PHP] Different php.ini files for different apache processes on one server

2006-07-18 Thread spam
Hi,
suppose you had several directories a, b and c where in each directory
you had an Apache http.conf file.  For each directory Apache gets started
with the http.conf (and other conf files) in that directory.

PHP is used a an Apache module.  How can I have a different php.ini file
for each different Apache process (a, b and c)? (Apache is 1.3.33 IIRC)



   KP

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



Re: [PHP] Different php.ini files for different apache processes on one server

2006-07-18 Thread Jochem Maas
 (Karl Pflästerer) wrote:
> Hi,
> suppose you had several directories a, b and c where in each directory
> you had an Apache http.conf file.  For each directory Apache gets started
> with the http.conf (and other conf files) in that directory.
> 
> PHP is used a an Apache module.  How can I have a different php.ini file
> for each different Apache process (a, b and c)? (Apache is 1.3.33 IIRC)
> 

probably your only recourse is too compile 3 different php modules (with 
different
php.ini paths).

I heard that there was an apache directive to allow you to specify the location
of php.ini but I know nothing about it and it's possible that it's an apache2 
only
thing.

can't think of any other way of doing what you want.

> 
> 
>KP
> 

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



[PHP] User defined function problem

2006-07-18 Thread Stephen Lake
Hey Guys and Gals,

I am having a small problem with a user defined function, I placed it in a 
config file and it works as expected, but the problem seems to arise only 
when I try to use my login script for a members area I am redeveloping.

The error message that comes up is the following:

Fatal error: Cannot redeclare clean_sql() (previously declared in 
C:\Apache2\htdocs\braille\config.php:94) in 
C:\Apache2\htdocs\braille\config.php on line 108

The problem is its claiming that I am trying to redeclare the function in 
the config file when there is only the original function.

I checked in other area's where this config file is being used and I do not 
get this error. Nor am I including other files that have the config included 
in them.

The problem is only in my login script. If anyone can give me a little 
insight into this error I would be greatly appreciated.

Best Regards,
Steve 

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



Re: [PHP] User defined function problem

2006-07-18 Thread Jon Anderson

This would be the simplest work-around I can think of.

In your config script, wrap an if around your function call:

if (!function_exists('clean_sql')) {
   function clean_sql() {
  ...
   }
}

jon

Stephen Lake wrote:

Hey Guys and Gals,

I am having a small problem with a user defined function, I placed it in a 
config file and it works as expected, but the problem seems to arise only 
when I try to use my login script for a members area I am redeveloping.


The error message that comes up is the following:

Fatal error: Cannot redeclare clean_sql() (previously declared in 
C:\Apache2\htdocs\braille\config.php:94) in 
C:\Apache2\htdocs\braille\config.php on line 108


The problem is its claiming that I am trying to redeclare the function in 
the config file when there is only the original function.


I checked in other area's where this config file is being used and I do not 
get this error. Nor am I including other files that have the config included 
in them.


The problem is only in my login script. If anyone can give me a little 
insight into this error I would be greatly appreciated.


Best Regards,
Steve 

  


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



Re: [PHP] User defined function problem

2006-07-18 Thread Jon Anderson
Oh, and the other obvious thing that I omitted would be to try using 
either the include_once() and require_once() functions wherever you 
include() or require() config.php.


jon

Stephen Lake wrote:

Hey Guys and Gals,

I am having a small problem with a user defined function, I placed it in a 
config file and it works as expected, but the problem seems to arise only 
when I try to use my login script for a members area I am redeveloping.


The error message that comes up is the following:

Fatal error: Cannot redeclare clean_sql() (previously declared in 
C:\Apache2\htdocs\braille\config.php:94) in 
C:\Apache2\htdocs\braille\config.php on line 108


The problem is its claiming that I am trying to redeclare the function in 
the config file when there is only the original function.


I checked in other area's where this config file is being used and I do not 
get this error. Nor am I including other files that have the config included 
in them.


The problem is only in my login script. If anyone can give me a little 
insight into this error I would be greatly appreciated.


Best Regards,
Steve 

  


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



Re: [PHP] Different php.ini files for different apache processes on one server

2006-07-18 Thread Michael B Allen
On Tue, 18 Jul 2006 20:44:35 +0200
<[EMAIL PROTECTED]>(Karl Pflästerer) wrote:

> Hi,
> suppose you had several directories a, b and c where in each directory
> you had an Apache http.conf file.  For each directory Apache gets started
> with the http.conf (and other conf files) in that directory.
> 
> PHP is used a an Apache module.  How can I have a different php.ini file
> for each different Apache process (a, b and c)? (Apache is 1.3.33 IIRC)

You could chroot each apache instance but I would probably try to modify
the apache module to accept a parameter (and in the process verify that
one does not already exist).

Mike

-- 
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/

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



Re: [PHP] User defined function problem

2006-07-18 Thread Stephen Lake
Thanks Jon,

That did the trick nicely, not sure why I didn't think of it myself but is 
glad for the reminder of what that function is for. :)

Best Regards,
Steve

"Jon Anderson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> This would be the simplest work-around I can think of.
>
> In your config script, wrap an if around your function call:
>
> if (!function_exists('clean_sql')) {
>function clean_sql() {
>   ...
>}
> }
>
> jon
>
> Stephen Lake wrote:
>> Hey Guys and Gals,
>>
>> I am having a small problem with a user defined function, I placed it in 
>> a config file and it works as expected, but the problem seems to arise 
>> only when I try to use my login script for a members area I am 
>> redeveloping.
>>
>> The error message that comes up is the following:
>>
>> Fatal error: Cannot redeclare clean_sql() (previously declared in 
>> C:\Apache2\htdocs\braille\config.php:94) in 
>> C:\Apache2\htdocs\braille\config.php on line 108
>>
>> The problem is its claiming that I am trying to redeclare the function in 
>> the config file when there is only the original function.
>>
>> I checked in other area's where this config file is being used and I do 
>> not get this error. Nor am I including other files that have the config 
>> included in them.
>>
>> The problem is only in my login script. If anyone can give me a little 
>> insight into this error I would be greatly appreciated.
>>
>> Best Regards,
>> Steve
>> 

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



Re: [PHP] User defined function problem

2006-07-18 Thread Jochem Maas
what Jon said.

but note it's better to stick your functions into a seperate 'funcs' file
and include_once() or require_once() that instead. at some stage you'll have so
many functions you may want to split them up into seperate 'funcs' files 
depending
on what they do (and/or what they are used for) but for now start by creating a
a single utility file that just contains functions you have written.

Stephen Lake wrote:
> Hey Guys and Gals,
> 
> I am having a small problem with a user defined function, I placed it in a 
> config file and it works as expected, but the problem seems to arise only 
> when I try to use my login script for a members area I am redeveloping.
> 
> The error message that comes up is the following:
> 
> Fatal error: Cannot redeclare clean_sql() (previously declared in 
> C:\Apache2\htdocs\braille\config.php:94) in 
> C:\Apache2\htdocs\braille\config.php on line 108
> 
> The problem is its claiming that I am trying to redeclare the function in 
> the config file when there is only the original function.
> 
> I checked in other area's where this config file is being used and I do not 
> get this error. Nor am I including other files that have the config included 
> in them.
> 
> The problem is only in my login script. If anyone can give me a little 
> insight into this error I would be greatly appreciated.
> 
> Best Regards,
> Steve 
> 

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



Re: [PHP] Name in HTML input

2006-07-18 Thread Ligaya Turmelle

Jay Blanchard wrote:

[snip]
  Thanks for your info.
  I am new in PHP , how to remove the the space and '(',')' ?
[/snip]

Use the delete key.


LOL

--

life is a game... so have fun.

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

Re: [PHP] pg_query and COPY in transaction

2006-07-18 Thread Chris

Luis Magaña wrote:

I have the following code:

pg_query($conn,"BEGIN TRANSACTION;
  DELETE FROM codigo_postal;
  COPY
codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
FROM '$tmpfname2' DELIMITER '|';
  COMMIT");


Separate them out as a first step:

$result = pg_query("begin");
if (!$result) {
  echo "error at line " . __LINE__ . ": " . pg_last_error() . "";
}

$result = pg_query("delete from codigo_postal;");
if (!$result) {
  echo "error at line " . __LINE__ . ": " . pg_last_error() . "";
}

$result = pg_query("COPY 
codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado) 
FROM '$tmpfname2' DELIMITER '|';");

if (!$result) {
  echo "error at line " . __LINE__ . ": " . pg_last_error() . "";
}

$result = pg_query("commit");
if (!$result) {
  echo "error at line " . __LINE__ . ": " . pg_last_error() . "";
}

and see if you get any errors.

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

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



[PHP] forcing a script to run on page unload

2006-07-18 Thread jekillen

Hi:
I have a web application that creates files and directories to save info
for a user. If the user decides to link to another page or site 
altogether

I want to run a script that will clean up after him or her but won't
interfere with where they are going. It will eventually expand
to asking the user if he or she wants to save the info for a return
visit. If they don't want to save it has to clean up after them
and if they do it goes through the process of tagging and
saving the info on the server.
My strategy is to run a spontaneous form submission with the
body onunload event. Then run the script and exit. I seem to
remember a way to force a script to run and I've seen that
in a site that I visit occasionally. Even if I quit the browser
it still manages to delay the exit of the browser. But I don't
remember whether it was one of my books on php or the php
manual that this is in.
Can someone point me in the right direction?
Thanks in advance:
JK

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



Re: [PHP] forcing a script to run on page unload

2006-07-18 Thread Paul Scott

On Tue, 2006-07-18 at 21:32 -0700, jekillen wrote:
> in a site that I visit occasionally. Even if I quit the browser
> it still manages to delay the exit of the browser. But I don't
> remember whether it was one of my books on php or the php
> manual that this is in.
> Can someone point me in the right direction?

I think you are looking for something like this little class that I
wrote a while back:

http://www.phpclasses.org/browse/package/2837.html

It lets you close the browser and even log off completely, and will send
you an email once the process is done. I use it for a few things, large
PDF generation, importing _very_ large documents into our CMS, cleaning
up user garbage etc.

Take a look and see if it suits your needs. Let me know if you need some
help getting it going as well.

HTH

--Paul

All Email originating from UWC is covered by disclaimer  
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] PHP Love Letter

2006-07-18 Thread Martin Alterisio

Been quiet too much...

*This time, I seriously advise against running this piece of code unless you
know what you're doing*

Enjoy...

---



 Love Letter


acquaintances)) {
?>
 Dear name?>,
 I really enjoy your company and I would love to meet you again.
 I had a lot of fun last time and I can't wait to get to know you
better.
 Yours sincerely, name?>
intimateFriends)) {
?>
 Dear nickName?>,
 All I wanted to say is how lucky I'm to have met you, to have you by my
side.
 I can't think of a world without you. I can't possibly thank you enough
for all the happy moments you gave me.
 Yours, nickName
boyfriend) && $her->boyfriend == $me) {
   $loversNicknames = array('Honey', 'Sweetie', 'Baby', 'Princess',
'Queen', 'Love', 'Sunshine');
?>
 My ,
 I couldn't wait to tell you how much I love you.
 You're the only one, the reason why I'm on this world. The only place I
wanna be is besides you.
 Missing you already, your Love
husband) && $her->husband== $me) {
?>
 I love you.
 PS: What's for dinner?
 /dev/null');
   // Now, get your lazy ass out there
   exit;
 }
?>




Re: [PHP] PHP Love Letter

2006-07-18 Thread Ligaya Turmelle

Martin Alterisio wrote:

Been quiet too much...

*This time, I seriously advise against running this piece of code unless 
you

know what you're doing*

Enjoy...

---



 Love Letter


acquaintances)) {
?>
 Dear name?>,
 I really enjoy your company and I would love to meet you again.
 I had a lot of fun last time and I can't wait to get to know you
better.
 Yours sincerely, name?>
intimateFriends)) {
?>
 Dear nickName?>,
 All I wanted to say is how lucky I'm to have met you, to have you by my
side.
 I can't think of a world without you. I can't possibly thank you enough
for all the happy moments you gave me.
 Yours, nickName
boyfriend) && $her->boyfriend == $me) {
   $loversNicknames = array('Honey', 'Sweetie', 'Baby', 'Princess',
'Queen', 'Love', 'Sunshine');
?>
 My ,
 I couldn't wait to tell you how much I love you.
 You're the only one, the reason why I'm on this world. The only place I
wanna be is besides you.
 Missing you already, your Love
husband) && $her->husband== $me) {
?>
 I love you.
 PS: What's for dinner?
 /dev/null');
   // Now, get your lazy ass out there
   exit;
 }
?>




Finally get to the heart of the matter with the PS... LOL

Nice work - but if I ever found out my husband used a program that ran 
on cron to send me a love letter - I would be both impressed (that he 
coded it since he doesn't code) and by the 3rd one waiting for flowers 
as well.


--

life is a game... so have fun.

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