Re: [PHP] Re: PhpMailer vs Pear:Mail

2005-11-29 Thread Richard Heyes

Petr Smith wrote:

Cabbar Duzayak wrote:


Could you please tell which one you recommend in terms of
stability/speed and share your experience in terms of these 2?

Thanks...



I tried all and ended with http://www.phpguru.org/static/htmlMimeMail5.html

fast, stable, usable.


A very good choice. ;-)

--
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] help avoid multiple login

2005-11-29 Thread Jochem Maas

Matt Monaco wrote:
If you store your "login object" in a session, when the browser window is 
closed the object will automatically be destroyed, thus calling the 
destructor.


exactly what is it that triggers the object destruction??? since when is it
normal practice for a browser to do a request to tell a webserver that it is 
closing
[itself]???

you cannot do this at all with just php, HTTP is stateless!

it might be possible to use some browser plugin to hit the server
if it notices that it's window is being closed... although I have a sneaking
suspicion that Flash, for instance, has the same problem as javascript with
not being able to differentiate between the page unloading and the window 
closing.

**as far as I know there is NO WAY to tell when the user closes the window, 
unless
you give them a specific way of telling you (e.g. via a 'log off and close the 
window'
link) and they are nice enough to only use the mechanism you provide (fat 
chance :-).

the normal way of doing session 'closing' is by way of 'garbage collection' -
every now and then a script/process/function is run that 'closes' any sessions
which are (according to your criteria) inactive. php has stuff built it that 
will
do this for you to a degree.



In response to the message you send directly to me, you would create a file 
called Login.class.php and at the top of each page include the file using 
require_once("Login.class.php");


Matt


""mail.pmpa"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]



De: Matt Monaco [mailto:[EMAIL PROTECTED]
Create an object with the functionality of your choosing, in the destructor




perform your cleanup operations.



The problem is I don't know when a member closes the browser window.
If I knew that i would automatically logout that member.

Thanks. 



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



Re: [PHP] help avoid multiple login

2005-11-29 Thread Richard Heyes

Jochem Maas wrote:


it might be possible to use some browser plugin to hit the server
if it notices that it's window is being closed... although I have a 
sneaking

suspicion that Flash, for instance, has the same problem as javascript with
not being able to differentiate between the page unloading and the 
window closing.


**as far as I know there is NO WAY to tell when the user closes the 
window, unless
you give them a specific way of telling you (e.g. via a 'log off and 
close the window'
link) and they are nice enough to only use the mechanism you provide 
(fat chance :-).


You could use the onunload event to make an AJAX style call...

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onunload.asp

--
Richard Heyes
http://www.phpguru.org

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



RE: [PHP] Database problem?

2005-11-29 Thread Ford, Mike
On 28 November 2005 19:28, Jim Moseby wrote:

> > Damn! It Worked. Thanks :)
> > 
> 
> 
> Even so, John's excellent advice should still be taken.  You should
> not generally code with a dependence on register_globals, for reasons
> you have just seen.

Also, it seems likely that register_globals will go away completely in PHP 6, 
so writing new code now that depends on it being on is just foolish.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] Re: Two version of PHP in single server

2005-11-29 Thread Petr Smith
Run two Apache servers, second (with old PHP version) on another port. 
Internally forward all requests to old PHP project to this second server.


We tested most methods but this was the best.

Petr

J.F.Kishor wrote:

Hi,

Thanks...!

Even the second is server-parsed not cgi

Some   more  suggestions   are  welcomed,   so  we   can   succeed  in
experimentation of Two version of PHP in same server.





i haven't tried this since php3/4, but it used to be that you could
install them both (as server parsed, not one as a cgi) and then use
different file extensions (and appropriate apache entries) to direct
which php version parsed the page. e.g., we used ".php3" to use the
php3 install and ".php" for php4.

i have a sense that this may be harder (or potentially impossible)
now, but you may want to look at the apache install documentation to
see if it gives hints. there used to be information in, i believe,
the apache source install documentation explaining how to do this.

as someone else has indicated, you can (or at least should be able
to) install one version as server-parsed and the second as cgi,
though that may not meet your needs.


 Original Message 


Date: Monday, November 28, 2005 12:07:02 PM +0530
From: "J.F.Kishor" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Subject: [PHP] Two version of PHP in single server

Hi,

I have  a query, can we run  two versions of PHP  in linux 7.2
server.

I want  to use PHP 4.x  for one application and  PHP 5.1.0 for
another application in the same server.

Do  I need to  do some  configuration changes  to set  the php
path. To  look up different  versions based on the  request of
the application.



Regards,
- JFK
kishor
Nilgiri Networks

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


-- End Original Message --






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



Re: [PHP] help avoid multiple login

2005-11-29 Thread Jochem Maas

Richard Heyes wrote:

Jochem Maas wrote:


it might be possible to use some browser plugin to hit the server
if it notices that it's window is being closed... although I have a 
sneaking
suspicion that Flash, for instance, has the same problem as javascript 
with
not being able to differentiate between the page unloading and the 
window closing.


**as far as I know there is NO WAY to tell when the user closes the 
window, unless
you give them a specific way of telling you (e.g. via a 'log off and 
close the window'
link) and they are nice enough to only use the mechanism you provide 
(fat chance :-).



You could use the onunload event to make an AJAX style call...


but there in lies a problem ... the onunload event fires everytime a page
is unloaded (i.e. everytime you request a new page) as well as when you
close the window. which effectively makes it useless for trapping when someone
closes the browser.

on top of that the user may have a 100 windows open for the same site ... if 
they
close one then the session should remain active/valid - so in effect one would
have to trap each window close and check if its the last window that was closed 
...
this is the road to madness ...

not to mention the Opera browser functionality of being able to close the 
browser
and open it again _exactly_ where you left off (no doubt a feature other 
browsers
will start to emulate) which more than likely has some reliance on session 
cookies.

pity there isn't an onsiteleave event :-)



http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onunload.asp 





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



[PHP] preg_slipt

2005-11-29 Thread Sichta Daniel
Hi all !!!
 
I have string like this "1234567890"
 
I need to split this into array like this
a[0] = "12"
a[1] = "34" 
a[2] = "56" 
a[3] = "78" 
a[4] = "90"
 
I know that for this is preg_split, but I don't know the string patern
for split.
Thank you in advance !!
 

Dan

 


Re: [PHP] preg_slipt

2005-11-29 Thread David Grant
Hi Dan,

Try:

$a = split("\n", chunk_split('1234567890', 2), 5);

php.net/chunk_split
php.net/split

Cheers,

David Grant

Sichta Daniel wrote:
> Hi all !!!
>  
> I have string like this "1234567890"
>  
> I need to split this into array like this
> a[0] = "12"
> a[1] = "34" 
> a[2] = "56" 
> a[3] = "78" 
> a[4] = "90"
>  
> I know that for this is preg_split, but I don't know the string patern
> for split.
> Thank you in advance !!
>  
> 
> Dan
> 
>  
> 

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



Re: [PHP] preg_slipt

2005-11-29 Thread David Precious
On 29/11/05, Sichta Daniel <[EMAIL PROTECTED]> wrote:
> Hi all !!!
>
> I have string like this "1234567890"
>
> I need to split this into array like this
> a[0] = "12"
> a[1] = "34"
> a[2] = "56"
> a[3] = "78"
> a[4] = "90"
>
> I know that for this is preg_split, but I don't know the string patern
> for split.
> Thank you in advance !!


No, preg_split would be overkill here, you want to take a look at str_split:

http://uk.php.net/manual/en/function.str-split.php

To achieve what you described above:



Simple eh?  Does exactly what it says on the tin.

:-)

Cheers

David Precious
http://www.preshweb.co.uk/

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



Re: [PHP] preg_slipt

2005-11-29 Thread David Grant
There is an error in this code.  It should in fact read:

$a = split("\r\n", chunk_split('1234567890', 2), 5);

OR

$a = split("\n", chunk_split('1234567890', 2, "\n"), 5);

David Grant wrote:
> Hi Dan,
> 
> Try:
> 
> $a = split("\n", chunk_split('1234567890', 2), 5);
> 
> php.net/chunk_split
> php.net/split
> 
> Cheers,
> 
> David Grant
> 
> Sichta Daniel wrote:
>> Hi all !!!
>>  
>> I have string like this "1234567890"
>>  
>> I need to split this into array like this
>> a[0] = "12"
>> a[1] = "34" 
>> a[2] = "56" 
>> a[3] = "78" 
>> a[4] = "90"
>>  
>> I know that for this is preg_split, but I don't know the string patern
>> for split.
>> Thank you in advance !!
>>  
>>
>> Dan
>>
>>  
>>
> 

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



Re: [PHP] preg_slipt

2005-11-29 Thread David Precious
> > No, preg_split would be overkill here, you want to take a look at
> > str_split:

> Sorry I forgott to tell that I'm not using PHP 5.x :-)

Ahhh, right - my answer won't be of much use to you then :-)

In that case, David Grant's suggestion of using chunk_split() in
combination with split() is probably your best option then!

Cheers

Dave P

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



[PHP] exclude part of text

2005-11-29 Thread 021

Hi,
need some help with this one

i made a page which is reading the last line from a log file. the log is 
formatted like this:


text1 > MAIN TEXT *text2

i need to get only the MAIN TEXT part, i don't need the text1 > and *text2

i'm using this code



thanx

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



Re: [PHP] exclude part of text

2005-11-29 Thread David Grant
Hi,

021 wrote:
>  $lines = file('sometext.txt');
> for ($i = 0, $j = count($lines); $i <=1; $i++) {
> print $lines[$j - $i];
> }
> ?>

For a start, try this instead:

$lines = file('sometext.ext');
$last  = end($lines);

Secondly, do you have an example of the real log file?

Cheers,

David Grant
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] exclude part of text

2005-11-29 Thread 021

the log file is from a radio playlist:

TIME > ARTIST - TITLE *SONG_CATEGORY

for example

17:12:26 > THE CURE - ALT.END *NEW

the values before > and after * are changing, hope there's a simple 
solution for this


thanx

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



Re: [PHP] exclude part of text

2005-11-29 Thread David Grant
Please try:

preg_match('/^[^\>]*\>(.*)\*.*$/', $line, $matches);

021 wrote:
> the log file is from a radio playlist:
> 
> TIME > ARTIST - TITLE *SONG_CATEGORY
> 
> for example
> 
> 17:12:26 > THE CURE - ALT.END *NEW
> 
> the values before > and after * are changing, hope there's a simple
> solution for this
> 
> thanx
> 


-- 
David Grant
http://www.grant.org.uk/

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



[PHP] when to enter submitted in mysql?

2005-11-29 Thread [EMAIL PROTECTED]

Hi to all!
I have form made on 4 pages (by groups of questions). Right now my code 
works this way: once somebody submit the first page of the form his/her 
submitted info is entered in database with status=temp. I store the ID 
(insert_id()) in session and then every time visitor submit the next 
page I do update of the current record using ID.
But, I heard once that "the best" solution is store all entered info in 
session (array) and insert all info at once.

Or, instead in sessions, move submitted info with serialized array.

Opinions?

Thanks for help.

-afan

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



[PHP] Re: Two version of PHP in single server

2005-11-29 Thread Ben Litton
You can do this if you register a different add-type. Say php5 for the php  
5.1 pages and just php for the regular ones. You may (I can't recall) have  
to install one as mod_php and the other as a cgi. There are surely guides  
on the internet to help you get both running simultaneously.


On Mon, 28 Nov 2005 01:37:02 -0500, "J.F.Kishor"  
<[EMAIL PROTECTED]> wrote:



Hi,

I have  a query, can we run  two versions of PHP  in linux 7.2
server.

I want  to use PHP 4.x  for one application and  PHP 5.1.0 for
another application in the same server.

Do  I need to  do some  configuration changes  to set  the php
path. To  look up different  versions based on the  request of
the application.



Regards,
- JFK
kishor
Nilgiri Networks




--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



RE: [PHP] when to enter submitted in mysql?

2005-11-29 Thread Jim Moseby
> Hi to all!
> I have form made on 4 pages (by groups of questions). Right 
> now my code 
> works this way: once somebody submit the first page of the 
> form his/her 
> submitted info is entered in database with status=temp. I 
> store the ID 
> (insert_id()) in session and then every time visitor submit the next 
> page I do update of the current record using ID.
> But, I heard once that "the best" solution is store all 
> entered info in 
> session (array) and insert all info at once.
> Or, instead in sessions, move submitted info with serialized array.
> 
> Opinions?
> 

The upside to storing the data in session variables is that you make only ne
DB call at the end, saving processor, bandwidth, etc.  The downside is, that
if your user cannot complete the form, his data is lost and he has to start
all over again.  

Which one is best depends greatly on your environment and situation.  For
instance, if you have 1000 users onlin simultaneously filling out forms, and
the forms are simple, you would probably opt to use session variables and
make one DB call.  If you only have one or two online and the forms are 1000
questions long, your would want to write each page as it is completed.

JM

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



Re: [PHP] when to enter submitted in mysql?

2005-11-29 Thread David Grant
Personally, I'd keep it all in the session and write at the end, but
this approach has at least two drawbacks:

1. The user cannot complete the process at a later point.
2. You cannot conduct analysis of part-completed data.

Cheers,

David Grant

[EMAIL PROTECTED] wrote:
> Hi to all!
> I have form made on 4 pages (by groups of questions). Right now my code
> works this way: once somebody submit the first page of the form his/her
> submitted info is entered in database with status=temp. I store the ID
> (insert_id()) in session and then every time visitor submit the next
> page I do update of the current record using ID.
> But, I heard once that "the best" solution is store all entered info in
> session (array) and insert all info at once.
> Or, instead in sessions, move submitted info with serialized array.
> 
> Opinions?
> 
> Thanks for help.
> 
> -afan
> 


-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] Problem with Frames and Sessions

2005-11-29 Thread Brent Baisley
Frames are just nested windows, the server can't tell the difference  
between a page requested from a frame or a separate window and you  
should treat them as such. So if your frame was created before a  
session was created, it's not part of the session.



On Nov 28, 2005, at 6:52 PM, Shaun wrote:


Hi,

I have a frameset with a left column and a main column. I have a login
script with a form in the left column. When I log in I get a menu  
in the
left column which targets to the main column. My problem is that  
when I
click on links in the left column nothing appears in the main  
frame, however
if I refresh the browser then the links work. I am sure this must  
be a PHP
session problem but I don't have any experience using frames, does  
anyone

have suggestions as to what the problem might be?

Thanks for your advice.

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





--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

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



[PHP] Re: when to enter submitted in mysql?

2005-11-29 Thread Todd Cary
I track my sessions in the MySQL database in the session table.  There 
is a field, ExpireTime, so the table is self purging.


For the pages, I place them into a table, tmp_data, that has a sessionID 
field and ExpireTime.  When all pages are completed, the data is 
inserted into the data table.


If the user has cookies turned off, s/he cannot pickup where s/he left 
off since the sessionID was not stored.  Other than that it works well 
where my client is processing many thousands of Class Action lawsuit claims.


Actually, I use Interbase (Firebird) for this type of application.

Todd

[EMAIL PROTECTED] wrote:

Hi to all!
I have form made on 4 pages (by groups of questions). Right now my code 
works this way: once somebody submit the first page of the form his/her 
submitted info is entered in database with status=temp. I store the ID 
(insert_id()) in session and then every time visitor submit the next 
page I do update of the current record using ID.
But, I heard once that "the best" solution is store all entered info in 
session (array) and insert all info at once.

Or, instead in sessions, move submitted info with serialized array.

Opinions?

Thanks for help.

-afan


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



Re: [PHP] Re: when to enter submitted in mysql?

2005-11-29 Thread [EMAIL PROTECTED]

Ok. I got a picture. :)

Thanks to everybody!

-afan



Todd Cary wrote:

I track my sessions in the MySQL database in the session table.  There 
is a field, ExpireTime, so the table is self purging.


For the pages, I place them into a table, tmp_data, that has a 
sessionID field and ExpireTime.  When all pages are completed, the 
data is inserted into the data table.


If the user has cookies turned off, s/he cannot pickup where s/he left 
off since the sessionID was not stored.  Other than that it works well 
where my client is processing many thousands of Class Action lawsuit 
claims.


Actually, I use Interbase (Firebird) for this type of application.

Todd

[EMAIL PROTECTED] wrote:


Hi to all!
I have form made on 4 pages (by groups of questions). Right now my 
code works this way: once somebody submit the first page of the form 
his/her submitted info is entered in database with status=temp. I 
store the ID (insert_id()) in session and then every time visitor 
submit the next page I do update of the current record using ID.
But, I heard once that "the best" solution is store all entered info 
in session (array) and insert all info at once.

Or, instead in sessions, move submitted info with serialized array.

Opinions?

Thanks for help.

-afan





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



[PHP] Howto search in SQL for a specific character?

2005-11-29 Thread Gustav Wiberg

Hi there!

in PHP i Write..


$v1 = chr(39); //39 is apostrofe


$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = $v1";


Why doesn't this work?

I want the sql to select all nameOfPedigree - fields where the first 
character is apostrofe (')


/G
http://www.varupiraten.se/

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



RE: [PHP] Howto search in SQL for a specific character?

2005-11-29 Thread Jay Blanchard
[snip]
$v1 = chr(39); //39 is apostrofe

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?
[/snip]

Probably because the character set is misinterpreted. What happens when you
echo $v1? Try

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = ''' ";

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



Re: [PHP] Howto search in SQL for a specific character?

2005-11-29 Thread Gustav Wiberg

Hi

I'm sorry but this didn't work either? If I replaced the ' with for example 
an a it worked


/G

- Original Message - 
From: "Stephen Johnson" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, November 29, 2005 10:00 PM
Subject: Re: [PHP] Howto search in SQL for a specific character?



Try this :

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE  nameOfPedigree like
"'%";

The % is a wildcard and will give you the results you want.


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/
?>



From: Gustav Wiberg <[EMAIL PROTECTED]>
Organization: Gustav Wiberg
Reply-To: Gustav Wiberg <[EMAIL PROTECTED]>
Date: Tue, 29 Nov 2005 21:55:27 +0100
To: PHP General 
Subject: [PHP] Howto search in SQL for a specific character?

Hi there!

in PHP i Write..


$v1 = chr(39); //39 is apostrofe


$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?

I want the sql to select all nameOfPedigree - fields where the first
character is apostrofe (')

/G
http://www.varupiraten.se/

--
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] Howto search in SQL for a specific character?

2005-11-29 Thread Gustav Wiberg

Hi there!

This didn't work. Ok, mysql 4.x don't have support for the command. Exuse 
my.. didn't realize that before... I have to do this another way around... 
:-)


/G

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Tuesday, November 29, 2005 9:59 PM
Subject: RE: [PHP] Howto search in SQL for a specific character?



[snip]
$v1 = chr(39); //39 is apostrofe

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?
[/snip]

Probably because the character set is misinterpreted. What happens when 
you

echo $v1? Try

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
SUBSTR(nameOfPedigree,0,1) = ''' ";

--
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] Howto search in SQL for a specific character?

2005-11-29 Thread Jay Blanchard
[snip]
This didn't work. Ok, mysql 4.x don't have support for the command. Exuse 
my.. didn't realize that before... I have to do this another way around... 
[/snip]

Doesn;t have support for what command?

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



Re: [PHP] Howto search in SQL for a specific character?

2005-11-29 Thread tg-php
Probably because the apostrophe aka single quote is used the same way it and 
the double quotes (") are used in PHP, as a string delimiter.

What you're ending up with is:

SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = '

What you'd want is something more like:

SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = "'"

So maybe try this:

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) 
= \"$v1\"";

See if that works any better.

-TG





= = = Original message = = =

Hi there!

in PHP i Write..


$v1 = chr(39); //39 is apostrofe


$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?

I want the sql to select all nameOfPedigree - fields where the first 
character is apostrofe (')

/G
http://www.varupiraten.se/


___
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] Howto search in SQL for a specific character?

2005-11-29 Thread Stephen Johnson
Try this : 

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE  nameOfPedigree like
"'%";

The % is a wildcard and will give you the results you want.


http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: Gustav Wiberg <[EMAIL PROTECTED]>
> Organization: Gustav Wiberg
> Reply-To: Gustav Wiberg <[EMAIL PROTECTED]>
> Date: Tue, 29 Nov 2005 21:55:27 +0100
> To: PHP General 
> Subject: [PHP] Howto search in SQL for a specific character?
> 
> Hi there!
> 
> in PHP i Write..
> 
> 
> $v1 = chr(39); //39 is apostrofe
> 
> 
> $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
> SUBSTR(nameOfPedigree,0,1) = $v1";
> 
> Why doesn't this work?
> 
> I want the sql to select all nameOfPedigree - fields where the first
> character is apostrofe (')
> 
> /G
> http://www.varupiraten.se/
> 
> -- 
> 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



FW: [PHP] Howto search in SQL for a specific character? SOLVED

2005-11-29 Thread Jay Blanchard
FW to the listeven if it is top posting

-Original Message-
From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 29, 2005 3:49 PM
To: Jay Blanchard
Subject: Re: [PHP] Howto search in SQL for a specific character?


aha... ok.. that was the fault! Thanx! :-)

/G

- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "Jay Blanchard" 
<[EMAIL PROTECTED]>
Sent: Tuesday, November 29, 2005 10:24 PM
Subject: RE: [PHP] Howto search in SQL for a specific character?


> substring is the function in MySQL
>
> http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
>
> -Original Message-
> From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 29, 2005 3:19 PM
> To: Jay Blanchard
> Subject: Re: [PHP] Howto search in SQL for a specific character?
>
>
> substr() ?
>
> /G
>
> - Original Message - 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "Jay Blanchard"
> <[EMAIL PROTECTED]>; "PHP General" 
> Sent: Tuesday, November 29, 2005 10:13 PM
> Subject: RE: [PHP] Howto search in SQL for a specific character?
>
>
>> [snip]
>> This didn't work. Ok, mysql 4.x don't have support for the command. Exuse
>> my.. didn't realize that before... I have to do this another way 
>> around...
>> [/snip]
>>
>> Doesn;t have support for what command?
>>
>
> 

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



[PHP] migrating from http to https...

2005-11-29 Thread ganu

Hi all ,

I have a problem , when I am migrating my data from http://www.abc.com 
 to https://www.abc.com  for 
secure login purpose. I will loose all my data which I store in my session.


if suppose I am able to do it from http to https then from https to http 
I am getting the problem.


any  idea  to do this . Else  i  have the option  that  after  http to 
https I will close the connection and the user will again start a new 
session with the login/password.


any  ideas please...

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



[PHP] Schroedinger's Bug - may require exorcism...

2005-11-29 Thread Adam Atlas
So... I have this script (being called in a perfectly typical way by  
PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs  
perfectly, and sometimes chooses, totally haphazardly, to seemingly  
run itself twice, which of course causes it to die with a fatal error  
after it tries to redefine some functions.


As mysterious as that is, it turns out it must be something  
altogether more sinister. I tried putting die() at the end of the  
script, on the assumption that it was for some reason executing  
twice, yet behold: the problem is still present, and the PHP error  
log still complains about constants and functions being redefined!  
The problem, I therefore thought, cannot be that the script is being  
run twice. (In retrospect, this was the most likely possibility,  
because the page doesn't actually output anything if it dies with  
this error.) So for debugging, I added a bit that logs one message to  
a file immediately before the die() at the end of the file, and a  
different message after the die(). The die() seems to be working  
normally, in that it only logs the first message...


But wait a second! WTF? If the PHP error log is to be believed, then  
the script should be dying with a fatal error before it even *gets*  
to that point in the script, isn't it?


And the greater WTF is the fact that, as I mentioned above, every  
time the page is requested, it unpredictably either does this or  
works flawlessly. Oh my. How do I even *begin* to debug something  
like this?


Thanks for any help.
-- Adam Atlas

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



Re: [PHP] Schroedinger's Bug - may require exorcism...

2005-11-29 Thread Robert Cummings
On Tue, 2005-11-29 at 19:22, Adam Atlas wrote:
> So... I have this script (being called in a perfectly typical way by  
> PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs  
> perfectly, and sometimes chooses, totally haphazardly, to seemingly  
> run itself twice, which of course causes it to die with a fatal error  
> after it tries to redefine some functions.
> 
> As mysterious as that is, it turns out it must be something  
> altogether more sinister. I tried putting die() at the end of the  
> script, on the assumption that it was for some reason executing  
> twice, yet behold: the problem is still present, and the PHP error  
> log still complains about constants and functions being redefined!  
> The problem, I therefore thought, cannot be that the script is being  
> run twice. (In retrospect, this was the most likely possibility,  
> because the page doesn't actually output anything if it dies with  
> this error.) So for debugging, I added a bit that logs one message to  
> a file immediately before the die() at the end of the file, and a  
> different message after the die(). The die() seems to be working  
> normally, in that it only logs the first message...
> 
> But wait a second! WTF? If the PHP error log is to be believed, then  
> the script should be dying with a fatal error before it even *gets*  
> to that point in the script, isn't it?
> 
> And the greater WTF is the fact that, as I mentioned above, every  
> time the page is requested, it unpredictably either does this or  
> works flawlessly. Oh my. How do I even *begin* to debug something  
> like this?

I think you mean heisenbug...

http://en.wikipedia.org/wiki/Heisenbug
http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat

Do a grep for dynamic includes of the file script in question.
Alternatively do a grep for files that dynamically include the script in
question. Work your way to the root.

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] Re: PhpMailer vs Pear:Mail

2005-11-29 Thread Max Schwanekamp

Richard Heyes wrote:

Petr Smith wrote:
I tried all and ended with 
http://www.phpguru.org/static/htmlMimeMail5.html

fast, stable, usable.

A very good choice. ;-)


But but but, what *is* the advantage of one over the other?  I've been a 
PhpMailer devotee for some time.  PEAR::Mail is too spare, PhpMailer is 
reasonably quick and has proven quite stable (I've built a couple 
newsletter apps using it).  What's the advantage of Richard's package 
vs. the Pear one (on which he is a lead dev) vs. PhpMailer?


--
Max Schwanekamp
http://www.neptunewebworks.com/

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



Re: [PHP] Schroedinger's Bug - may require exorcism...

2005-11-29 Thread Robert Cummings
On Tue, 2005-11-29 at 19:42, Robert Cummings wrote:
> On Tue, 2005-11-29 at 19:22, Adam Atlas wrote:
> > So... I have this script (being called in a perfectly typical way by  
> > PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs  
> > perfectly, and sometimes chooses, totally haphazardly, to seemingly  
> > run itself twice, which of course causes it to die with a fatal error  
> > after it tries to redefine some functions.
> > 
> > As mysterious as that is, it turns out it must be something  
> > altogether more sinister. I tried putting die() at the end of the  
> > script, on the assumption that it was for some reason executing  
> > twice, yet behold: the problem is still present, and the PHP error  
> > log still complains about constants and functions being redefined!  
> > The problem, I therefore thought, cannot be that the script is being  
> > run twice. (In retrospect, this was the most likely possibility,  
> > because the page doesn't actually output anything if it dies with  
> > this error.) So for debugging, I added a bit that logs one message to  
> > a file immediately before the die() at the end of the file, and a  
> > different message after the die(). The die() seems to be working  
> > normally, in that it only logs the first message...
> > 
> > But wait a second! WTF? If the PHP error log is to be believed, then  
> > the script should be dying with a fatal error before it even *gets*  
> > to that point in the script, isn't it?
> > 
> > And the greater WTF is the fact that, as I mentioned above, every  
> > time the page is requested, it unpredictably either does this or  
> > works flawlessly. Oh my. How do I even *begin* to debug something  
> > like this?
> 
> I think you mean heisenbug...
> 
> http://en.wikipedia.org/wiki/Heisenbug
> http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat

Hmmm, you learn something new every day:

http://en.wikipedia.org/wiki/Schroedinbug

But the problem you're having seems better represented as a heisenbug :)

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

2005-11-29 Thread blackwater dev
I have a form where I am dynamically building a bunch of checkbox
inputs.  Then when submitted, I need to update the db.  Problem is, of
course, if the checkbox is unchecked then the $_POST doesn't have the
value in the array.  How can I get the value from $_POST even though
it's unchecked?

For example, here would be the generated form:

Car 1
Car 2
Car 3
Car 4

Then in the update I loop through:

foreach($_POST[cars] as $id=>$value){
//update vehicles set value to yes or no

}

But, if the unchecked values aren't in $_POST, how do I know to update them???

Thanks!

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



[PHP] url vs dirname(__FILE__)

2005-11-29 Thread Chris
I trying to create an absolute path to include scripts and images in another 
directory. For includes, I have found $path = dirname(__FILE__) 
."/mydir/myscript.php";

However, I am unable to reference an image using this path, like
echo "";

To reference an image I have to create another path variable which assembles 
a url like:

echo "http://"; . $_SERVER['HTTP_HOST'] . 
dirname($_SERVER['SCRIPT_NAME']) . "/mydir/myimage.gif>";

Is it possible to create just one absolute path variable for both the 
include and img src= or do I need to create two paths?

Thanks
cw

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



[PHP] help avoid multiple login

2005-11-29 Thread mail.pmpa
-Mensagem original-
De: Jochem Maas
(...)
the normal way of doing session 'closing' is by way of 'garbage collection'
- every now and then a script/process/function is run that 'closes' any
sessions which are (according to your criteria) inactive. php has stuff
built it that will do this for you to a degree.
-

Is there a way I can access sessions from other users on a script?
If yes I could store the session id on a table and later check if isset.

Thanks for replying.
Pedro.

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



[PHP] help avoid multiple login

2005-11-29 Thread mail.pmpa
-Mensagem original-
De: Jochem Maas
(...)
the normal way of doing session 'closing' is by way of 'garbage collection'
- every now and then a script/process/function is run that 'closes' any
sessions which are (according to your criteria) inactive. php has stuff
built it that will do this for you to a degree.
-

Is there a way I can access sessions from other users on a script?
If yes I could store the session id on a table and later check if isset.

Thanks for replying.
Pedro.

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



Re: [PHP] url vs dirname(__FILE__)

2005-11-29 Thread Chris Shiflett

Chris wrote:

I trying to create an absolute path to include scripts and images
in another directory.


These are two different things, but there is a relationship in the sense 
that URLs are translated to filesystem paths using document root:


http://host/path/to/script.php => [document root]/path/to/script.php

I think it's pretty important to understand the difference as well as 
the relationship. Once you do, your question might go away.


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] Re: PhpMailer vs Pear:Mail

2005-11-29 Thread Manuel Lemos

Hello,

on 11/29/2005 10:59 PM Max Schwanekamp said the following:

Richard Heyes wrote:

Petr Smith wrote:
I tried all and ended with 
http://www.phpguru.org/static/htmlMimeMail5.html

fast, stable, usable.

A very good choice. ;-)


But but but, what *is* the advantage of one over the other?  I've been a 
PhpMailer devotee for some time.  PEAR::Mail is too spare, PhpMailer is 
reasonably quick and has proven quite stable (I've built a couple 
newsletter apps using it).  What's the advantage of Richard's package 
vs. the Pear one (on which he is a lead dev) vs. PhpMailer?



Mind me for another opinion. I am not the right person to compare those 
packages because I do not use them. I use a MIME message class for many 
years that provides special resources for optimizing deliveries to many 
recipients like for instance newsletters.


Optimizing deliveries depend on the method that you use to deliver the 
messages. This package provides several different delivery methods that 
are implemented by different sub-classes in the package: mail(), 
sendmail, qmail, SMTP, Windows pickup folder.


You can tell the class to optimize the queueing of the messages for many 
recipients just by calling the function SetBulkMail(). Then whatever is 
the sub-class of the delivery method that you use, it will set its mode 
of operation to minimize the time that your script has to wait to queue 
all the messages to your recipients.


Furthermore, if your message body are the same for all the newsletter 
recipients, the class can cache the message body so it will not waste 
time rebuilding the message to all users.


All these techniques provide huge speedup. I use this package for many 
years. Currently it is used to send about 3.5 million newsletters a 
month and I can tell you that it is very fast queuing around 30 messages 
per second in a qmail based setup, all done in pure PHP code.


http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: checkboxes

2005-11-29 Thread Matt Monaco
Well if your keys are a straight sequence of numbers instead of a foreach 
you can do a for loop and for those whose value is not one, set to zero.

Matt


"blackwater dev" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
I have a form where I am dynamically building a bunch of checkbox
inputs.  Then when submitted, I need to update the db.  Problem is, of
course, if the checkbox is unchecked then the $_POST doesn't have the
value in the array.  How can I get the value from $_POST even though
it's unchecked?

For example, here would be the generated form:

Car 1
Car 2
Car 3
Car 4

Then in the update I loop through:

foreach($_POST[cars] as $id=>$value){
//update vehicles set value to yes or no

}

But, if the unchecked values aren't in $_POST, how do I know to update 
them???

Thanks! 

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



[PHP] How do i display a neat table of returned mysql data?

2005-11-29 Thread Dave Carrera

Hi List,

I have some mysql table data that i would like to display back to the 
web user in a neat and tidy way using php.


Data:

col1   col2   col3
test   1.99   F
test   1.99   F
test   1.99   F
test   0.99   F
test   1.99   F
bang 2.99   F
bang 3.99   F
bang 4.49   F
bang 2.99   F
bang 2.99   F

Table display i am hoping to display:
First the unique name of col1 as a header

testbang

Second a row each for each col2 and col3 where header above = col1 so 
the finished table looks like this


test   bang
1.99   F2.99   F
1.99   F3.99   F
1.99   F4.49   F
0.99   F2.99   F
1.99   F2.99   F

I will really appreiciate and help you may give with this question.

Thank you in advance

Dave C

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



Re: [PHP] Re: PhpMailer vs Pear:Mail

2005-11-29 Thread Curt Zirzow
On Tue, Nov 29, 2005 at 04:59:55PM -0800, Max Schwanekamp wrote:
> Richard Heyes wrote:
> >Petr Smith wrote:
> >>I tried all and ended with 
> >>http://www.phpguru.org/static/htmlMimeMail5.html
> >>fast, stable, usable.
> >A very good choice. ;-)
> 
> But but but, what *is* the advantage of one over the other?  I've been a 
> PhpMailer devotee for some time.  PEAR::Mail is too spare, PhpMailer is 
> reasonably quick and has proven quite stable (I've built a couple 
> newsletter apps using it).  What's the advantage of Richard's package 
> vs. the Pear one (on which he is a lead dev) vs. PhpMailer?

First off, the OT is rather to general to really know what is going
to be better, the only way to resolve it is to benchmark the
results, if you are sending one message heh.. good luck figuring
that out.

What i would be looking for is if there are tools to manage a
mailman list or ezlm list, i'd rather have an application that is
designed for sending out bulk emails than try to figure out what is
the best php Mail/STMP interface to send email to an MTA that will
most likely be the bottleneck anyway.

As for speed, you will  most likly have a issues with the actual
STMP server or the MTA trying to send the documents. Even if you
speed up on how fast php can send email to a STMP server directly or
inject the messages to the MTA, the messages can only be sent as
fast as they can be delivered, thus any effort to make php sending
mail faster is rather futile.

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Re: Two version of PHP in single server

2005-11-29 Thread Curt Zirzow
On Tue, Nov 29, 2005 at 09:31:25AM +0100, Petr Smith wrote:
> Run two Apache servers, second (with old PHP version) on another port. 
> Internally forward all requests to old PHP project to this second server.

you know I almost suggested this method, the only problem i had
with this is that well if the proxied server is busy it causes
extra load on the main server (due to the multiple requests)

> 
> We tested most methods but this was the best.

I've only set up this situation for development purposes.  It would
be intersting how apache performs against proxy request vs having a
module requested on a different port.

One thing that i know could be a factor is memory usage.

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] when to enter submitted in mysql?

2005-11-29 Thread Curt Zirzow
On Tue, Nov 29, 2005 at 11:57:49AM -0500, Jim Moseby wrote:
> > Hi to all!
> > I have form made on 4 pages (by groups of questions). Right 
> > now my code 
> > works this way: once somebody submit the first page of the 
> > form his/her 
> > submitted info is entered in database with status=temp. I 
> > store the ID 
> > (insert_id()) in session and then every time visitor submit the next 
> > page I do update of the current record using ID.
> > But, I heard once that "the best" solution is store all 
> > entered info in 
> > session (array) and insert all info at once.
> > Or, instead in sessions, move submitted info with serialized array.
> > 
> > Opinions?
> > 
> 
> The upside to storing the data in session variables is that you make only ne
> DB call at the end, saving processor, bandwidth, etc.  The downside is, that
> if your user cannot complete the form, his data is lost and he has to start
> all over again.  

Another upside is that you dont have to maintain old session data,
it is done for you.   If the user comes to your site and just does
3 of the 4 pages, you dont have to worry about cleaning up any
extra dead information.

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] migrating from http to https...

2005-11-29 Thread Curt Zirzow
On Wed, Nov 30, 2005 at 06:06:18AM +0530, ganu wrote:
> Hi all ,
> 
> I have a problem , when I am migrating my data from http://www.abc.com 
>  to https://www.abc.com  for 
> secure login purpose. I will loose all my data which I store in my session.

How do you mean by migrate?

If you are using the default setup for sessions (of course pending
how you installed), going from unsecure to secure shouldn't be a
problem, assuming this is all on the same machine.
 
> if suppose I am able to do it from http to https then from https to http 
> I am getting the problem.

moving from https to http can be a different storry, if the php.ini
setting for session.cookie_secure is set, then cookies* with the
https wont be accpeted when going to http.

* assuming that you are using php.ini: session.use_cookies.


Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] checkboxes

2005-11-29 Thread Curt Zirzow
On Tue, Nov 29, 2005 at 10:15:36PM -0500, blackwater dev wrote:
> I have a form where I am dynamically building a bunch of checkbox
> inputs.  Then when submitted, I need to update the db.  Problem is, of
> course, if the checkbox is unchecked then the $_POST doesn't have the
> value in the array.  How can I get the value from $_POST even though
> it's unchecked?
> 
> For example, here would be the generated form:
> 
> Car 1
> Car 2
> Car 3
> Car 4
> 
> Then in the update I loop through:
> 
> foreach($_POST[cars] as $id=>$value){
> //update vehicles set value to yes or no
> 
> }

This is a good example on how *not* to trust data via form data
posted.  I'm assuming you have some sort of one to many relation
going on:

  table lot {
id int,
lot varchar(255)  -- Lot 1 
  }

  table vehicles {
id int,
name varchar(255) -- Car 1, Car 2, etc... 
  }

  table lotvehicle {
lot_id int,
vehicle_id int,
  }

The form value of cars[X] where X being the id of vehicle and the
value of 1 being it is selected (although with  the form definition
you just want to know if if cars[X] is defined.).

So we have a form that will eventually need to knnow  what values
should be selected. Potentially data alreadly exists that may have
the same records. There are two options (or perhaps more) to
approach this:

Decide as we go approach and clean up:

  1) Grap the 'vehicles' currently assoicated with the 'lot'
  2) if 'vehicle' is currently selected do nothing
  3) if 'vehicle' is a new item we should add 'vehicle' as long as it
 is a valid 'vehicle;
  4) repeat 2 and 3 until we looked at all the data
  5) figure out which ones should be deleted and delete them.


Forget everything, we'll add what is valid (the lazy way):

  1) delete every associated record to the 'lot'
  2) for each 'vehicle' add 'vehicle' as long as it is a valid
 'vehicle'


HTH,

Curt.
-- 
cat .signature: No such file or directory

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