Re: [PHP] strlen ?

2013-07-05 Thread Lester Caine

Jim Giner wrote:

And the answer is - yes, there is a LF char at the end of my data in my whole
table.

Now the question is - how the heck did I put that in there?  Certainly not
intentionally.  The data is captured from a d/e screen I wrote and it simply
grabs the post value and inserts a new record with that value along with some
other values.  And I don't see anything concatenating a LF to my string.


The obvious question that comes to mind is 'What OS'? Having seen this sort of 
niggle many times I tend to find it relates to something working 'cross-os' a 
bit like windows ignoring case in file name and linux then complaining it can't 
find a file.


It's probably worth checking the sting length back through your code just to 
confirm what added it?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] strlen ?

2013-07-05 Thread Ashley Sheridan


Jim Giner  wrote:

>On 7/5/2013 3:02 PM, Stephen wrote:
>> On 13-07-05 02:50 PM, Jim Giner wrote:
>>>
>>> Now the question is - how the heck did I put that in there?
>Certainly
>>> not intentionally.  The data is captured from a d/e screen I wrote
>and
>>> it simply grabs the post value and inserts a new record with that
>>> value along with some other values.  And I don't see anything
>>> concatenating a LF to my string.
>>>
>> Is this a browser being used for input? Never assume what a browser
>will
>> do.
>>
>> It is good practice to validate and condition data before inserting
>into
>> a database.
>>
>> Consider trimming the data before doing the INSERT.
>>
>I do validate my data by quoting it but I never expected to have to do
>a 
>trim to remove a LF.  Especially on an iphone for input, since it's not
>
>easy to enter a LF.

Quoting the data is not the same thing as validating it.

Thanks,
Ash

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



Re: [PHP] Guaranteed Way to Get Error Message Wanted

2013-07-05 Thread Ken Robinson
Check the permissions on the files/directories involved. I get this 
on Linux when the files/directories are too open.


Ken

At 05:38 PM 7/5/2013, Brian Smither wrote:
I have an application running under PHP-5.4.17-TS-VC9 (and .14 as of 
yesterday) with Aprelium's Abyss X1 v2.8 web server in FastCGI mode 
on WinXPSP3.


An earlier version of this application works. The current version 
causes a 500 Internal Server Error. There is no entry in PHP's 
(fully active) error log. I cannot decipher Abyss's logging, so I 
cannot determine if a clue was reported by Abyss or not.


The current version works on a different system (Server 2003, PHP 
5.3.5-TS-VC6 (Apache module), Apache 2.2).


What I would like to have is a method of getting PHP to report in 
some undeniable manner, short of total system failure, what it 
doesn't like about whatever killed it.





--
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] Find a list of function that clashes?

2013-07-05 Thread Daniel
Hello all,

I'm just wondering if there is a way of getting a list of functions
that will clash across 2 folders.

I'm trying to update wp-united so that I can use it with WordPress
multisite. I know that some of the functions are the same in both
phpbb and WordPress. Is there any way of generating a list of all the
functions that are the same across both phpbb and WordPress?

Regards

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



Re: [PHP] strlen ?

2013-07-05 Thread John Meyer

MOTS:  never take any input on faith.


Jim Giner wrote:

On 7/5/2013 3:02 PM, Stephen wrote:

On 13-07-05 02:50 PM, Jim Giner wrote:


Now the question is - how the heck did I put that in there? Certainly
not intentionally.  The data is captured from a d/e screen I wrote and
it simply grabs the post value and inserts a new record with that
value along with some other values.  And I don't see anything
concatenating a LF to my string.


Is this a browser being used for input? Never assume what a browser will
do.

It is good practice to validate and condition data before inserting into
a database.

Consider trimming the data before doing the INSERT.

I do validate my data by quoting it but I never expected to have to do 
a trim to remove a LF.  Especially on an iphone for input, since it's 
not easy to enter a LF.





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



[PHP] Guaranteed Way to Get Error Message Wanted

2013-07-05 Thread Brian Smither
I have an application running under PHP-5.4.17-TS-VC9 (and .14 as of yesterday) 
with Aprelium's Abyss X1 v2.8 web server in FastCGI mode on WinXPSP3.

An earlier version of this application works. The current version causes a 500 
Internal Server Error. There is no entry in PHP's (fully active) error log. I 
cannot decipher Abyss's logging, so I cannot determine if a clue was reported 
by Abyss or not.

The current version works on a different system (Server 2003, PHP 5.3.5-TS-VC6 
(Apache module), Apache 2.2).

What I would like to have is a method of getting PHP to report in some 
undeniable manner, short of total system failure, what it doesn't like about 
whatever killed it.




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



Re: [PHP] strlen ?

2013-07-05 Thread Jim Giner

On 7/5/2013 3:02 PM, Stephen wrote:

On 13-07-05 02:50 PM, Jim Giner wrote:


Now the question is - how the heck did I put that in there? Certainly
not intentionally.  The data is captured from a d/e screen I wrote and
it simply grabs the post value and inserts a new record with that
value along with some other values.  And I don't see anything
concatenating a LF to my string.


Is this a browser being used for input? Never assume what a browser will
do.

It is good practice to validate and condition data before inserting into
a database.

Consider trimming the data before doing the INSERT.

I do validate my data by quoting it but I never expected to have to do a 
trim to remove a LF.  Especially on an iphone for input, since it's not 
easy to enter a LF.


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



Re: [PHP] strlen ?

2013-07-05 Thread Stephen

On 13-07-05 02:50 PM, Jim Giner wrote:


Now the question is - how the heck did I put that in there? Certainly 
not intentionally.  The data is captured from a d/e screen I wrote and 
it simply grabs the post value and inserts a new record with that 
value along with some other values.  And I don't see anything 
concatenating a LF to my string.



Is this a browser being used for input? Never assume what a browser will do.

It is good practice to validate and condition data before inserting into 
a database.


Consider trimming the data before doing the INSERT.

--
Stephen


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



Re: [PHP] strlen ?

2013-07-05 Thread Jim Giner

On 7/5/2013 2:42 PM, Matijn Woudt wrote:

On Fri, Jul 5, 2013 at 8:39 PM, Jim Giner wrote:


  I checked them in the db manually.  Clicked on the name, selected it, no
extra space highlighted.  Cursored through the length of the value - no
extra movements.



That does still not guarantee there are no extra characters. Some
characters are just not visible (NUL, CR, LF, ..)




On 7/5/2013 2:36 PM, Matijn Woudt wrote:




On Fri, Jul 5, 2013 at 8:33 PM, Jim Giner wrote:


On 7/5/2013 1:32 PM, shiplu wrote:


On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner 
wrote:


  Mike Hall  comes back as 10, not 9

F.B. comes back as 5, not 4.



Doesn't work for me.

php > var_dump("Mike Hall", strlen("Mike Hall"));
string(9) "Mike Hall"
int(9)

Try trimming it first and then apply strlen.


  Why would I need to trim something that I can already see doesn't have

any trailing or leading characters?



  Because there are characters you can't see?





And the answer is - yes, there is a LF char at the end of my data in my 
whole table.


Now the question is - how the heck did I put that in there?  Certainly 
not intentionally.  The data is captured from a d/e screen I wrote and 
it simply grabs the post value and inserts a new record with that value 
along with some other values.  And I don't see anything concatenating a 
LF to my string.


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



Re: [PHP] strlen ?

2013-07-05 Thread Matijn Woudt
On Fri, Jul 5, 2013 at 8:39 PM, Jim Giner wrote:

>  I checked them in the db manually.  Clicked on the name, selected it, no
> extra space highlighted.  Cursored through the length of the value - no
> extra movements.
>

That does still not guarantee there are no extra characters. Some
characters are just not visible (NUL, CR, LF, ..)


>
> On 7/5/2013 2:36 PM, Matijn Woudt wrote:
>
>
>
>
> On Fri, Jul 5, 2013 at 8:33 PM, Jim Giner wrote:
>
>> On 7/5/2013 1:32 PM, shiplu wrote:
>>
>>> On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner >> >wrote:
>>>
>>>  Mike Hall  comes back as 10, not 9
 F.B. comes back as 5, not 4.


>>> Doesn't work for me.
>>>
>>> php > var_dump("Mike Hall", strlen("Mike Hall"));
>>> string(9) "Mike Hall"
>>> int(9)
>>>
>>> Try trimming it first and then apply strlen.
>>>
>>>
>>>  Why would I need to trim something that I can already see doesn't have
>> any trailing or leading characters?
>>
>>
>  Because there are characters you can't see?
>
>
>


Re: [PHP] strlen ?

2013-07-05 Thread Matijn Woudt
On Fri, Jul 5, 2013 at 8:33 PM, Jim Giner wrote:

> On 7/5/2013 1:32 PM, shiplu wrote:
>
>> On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner 
>> **wrote:
>>
>>  Mike Hall  comes back as 10, not 9
>>> F.B. comes back as 5, not 4.
>>>
>>>
>> Doesn't work for me.
>>
>> php > var_dump("Mike Hall", strlen("Mike Hall"));
>> string(9) "Mike Hall"
>> int(9)
>>
>> Try trimming it first and then apply strlen.
>>
>>
>>  Why would I need to trim something that I can already see doesn't have
> any trailing or leading characters?
>
>
Because there are characters you can't see?


Re: [PHP] strlen ?

2013-07-05 Thread Jim Giner

On 7/5/2013 1:32 PM, shiplu wrote:

On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner wrote:


Mike Hall  comes back as 10, not 9
F.B. comes back as 5, not 4.



Doesn't work for me.

php > var_dump("Mike Hall", strlen("Mike Hall"));
string(9) "Mike Hall"
int(9)

Try trimming it first and then apply strlen.


Why would I need to trim something that I can already see doesn't have 
any trailing or leading characters?


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



Re: [PHP] strlen ?

2013-07-05 Thread shiplu
On Fri, Jul 5, 2013 at 11:10 PM, Jim Giner wrote:

> Mike Hall  comes back as 10, not 9
> F.B. comes back as 5, not 4.
>

Doesn't work for me.

php > var_dump("Mike Hall", strlen("Mike Hall"));
string(9) "Mike Hall"
int(9)

Try trimming it first and then apply strlen.


-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


Re: [PHP] strlen ?

2013-07-05 Thread John Meyer

Jim Giner wrote:
Trying to manage line breaks in some output I'm generating and using 
strlen to measure the lengths of the strings I'm printing. Discovered 
something strange (to me!) in that strlen is returning +1 more than it 
should.


The strings are from a query of my database - simple name fields. But 
everyone of them is coming back with a length that is one more than I 
see.


Ex.

Mike Hall  comes back as 10, not 9
F.B. comes back as 5, not 4.

I've looked at my data and counted the chars - there is no extra space 
at the beginning or end in my table.


Anyone have an explanation?


Does strlen count the line feed?

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



[PHP] strlen ?

2013-07-05 Thread Jim Giner
Trying to manage line breaks in some output I'm generating and using 
strlen to measure the lengths of the strings I'm printing.  Discovered 
something strange (to me!) in that strlen is returning +1 more than it 
should.


The strings are from a query of my database - simple name fields.  But 
everyone of them is coming back with a length that is one more than I see.


Ex.

Mike Hall  comes back as 10, not 9
F.B. comes back as 5, not 4.

I've looked at my data and counted the chars - there is no extra space 
at the beginning or end in my table.


Anyone have an explanation?

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



[PHP] Fwd: Hmm.. I got NULL here. Why?

2013-07-05 Thread Karl-Arne Gjersøyen
My PHP Source
=
";
var_dump($kg_pa_lager);
?>

My var_dump() value;
==
string(84) "SELECT kg_pa_lager FROM dynamit WHERE valgt_lager = 'Tengs' AND
varenr = 'EDY22X180'"
NULL

My Database table:
===
mysql> SELECT * FROM dynamit;
++-+---++---+--++-+
| leverandor | valgt_lager | type  | dim_mm | un_nr | varenavn |
varenr | kg_pa_lager |
++-+---++---+--++-+
| Orica  | Tengs   | Papirpatroner | 22x180 | 0081  | Dynamit  |
EDY22X180K | 100 |
| Orica  | Tengs   | Papirpatroner | 25x180 | 0081  | Dynamit  |
EDY25X180  | 100 |
| Orica  | Tengs   | Plastpølse   | 45x540 | 0081  | Dynamit  |
EDY45X540  | 100 |
++-+---++---+--++-+
3 rows in set (0.00 sec)

mysql>

The Problem:
==
If I do this:
$sql = "SELECT kg_pa_lager FROM dynamit WHERE valgt_lager = '$valgt_lager'";
I got 100100100 for kg_pa_lager

But if I do this:
$sql = "SELECT kg_pa_lager FROM dynamit WHERE valgt_lager = '$valgt_lager'
AND varenr = '$varenr'";
I got NULL.

Look at varenr = EDY22X180 in the select where and that it is in the table
under varenr.
But why is kg_pa_lager NULL?

This is strange to me but I guess you know why?
Thanks for your advice.

Karl

I got the solution. I had forget to write "K" at end of the serial number.
Now it is OK.
Karl


[PHP] Hmm.. I got NULL here. Why?

2013-07-05 Thread Karl-Arne Gjersøyen
My PHP Source
=
";
var_dump($kg_pa_lager);
?>

My var_dump() value;
==
string(84) "SELECT kg_pa_lager FROM dynamit WHERE valgt_lager = 'Tengs' AND
varenr = 'EDY22X180'"
NULL

My Database table:
===
mysql> SELECT * FROM dynamit;
++-+---++---+--++-+
| leverandor | valgt_lager | type  | dim_mm | un_nr | varenavn |
varenr | kg_pa_lager |
++-+---++---+--++-+
| Orica  | Tengs   | Papirpatroner | 22x180 | 0081  | Dynamit  |
EDY22X180K | 100 |
| Orica  | Tengs   | Papirpatroner | 25x180 | 0081  | Dynamit  |
EDY25X180  | 100 |
| Orica  | Tengs   | Plastpølse   | 45x540 | 0081  | Dynamit  |
EDY45X540  | 100 |
++-+---++---+--++-+
3 rows in set (0.00 sec)

mysql>

The Problem:
==
If I do this:
$sql = "SELECT kg_pa_lager FROM dynamit WHERE valgt_lager = '$valgt_lager'";
I got 100100100 for kg_pa_lager

But if I do this:
$sql = "SELECT kg_pa_lager FROM dynamit WHERE valgt_lager = '$valgt_lager'
AND varenr = '$varenr'";
I got NULL.

Look at varenr = EDY22X180 in the select where and that it is in the table
under varenr.
But why is kg_pa_lager NULL?

This is strange to me but I guess you know why?
Thanks for your advice.

Karl


Re: [PHP] Can this work?

2013-07-05 Thread Ashley Sheridan
Can't you just use a number field, which is a hell of a lot easier (especially 
on an iPad) to use than a bunch of select lists.

"Karl-Arne Gjersøyen"  wrote:

>2013/7/5 Stuart Dallas 
>
>> On 5 Jul 2013, at 15:05, Karl-Arne Gjersøyen 
>wrote:
>>
>> > 2013/7/5 Stuart Dallas 
>> >
>> >> On 5 Jul 2013, at 14:56, Karl-Arne Gjersøyen 
>> wrote:
>> >>
>> >>> Hello. I have a form in HTML/PHP with for loops that generate a
>> selected
>> >>> list like this:
>> >>> for($i = 1; $i< 25;$i++ ){
>> >>> 
>> >>> }
>> >>>
>> >>> The lists look like this:
>> >>>
>> >>> http://localhost/%7Ekarl/kasen/io/kp/index.php>"
>> >>> method="post">> >>> value="1-25" selected="selected">1-25> >>> value="1">12> >>> value="3">34> >>> value="5">56> >>> value="7">78> >>> value="9">910> >>> value="11">1112> >>> value="13">1314> >>> value="15">1516> >>> value="17">1718> >>> value="19">1920> >>> value="21">2122> >>> value="23">2324> >>> value="25">25 Kg > >>> name="valgt_dynamit_polse_26-50kg">> >>> selected="selected">26-50> >>> value="26">2627> >>> value="28">2829> >>> value="30">3031> >>> value="32">3233> >>> value="34">3435> >>> value="36">3637> >>> value="38">3839> >>> value="40">4041> >>> value="42">4243> >>> value="44">4445> >>> value="46">4647> >>> value="48">4849> >>> value="50">50 Kg 
>> >>>
>> >>> What I try to do with it is to register the selected value and do
>> >> something
>> >>> with it. The lists is weight in KG. I hope to select only one
>value
>> >> between
>> >>> 1-25kg OR 26-50kg. I don't know if this is possible? What do you
>think?
>> >>
>> >> If the range of acceptable values is 1-50, why do you have two
>select
>> >> fields instead of one?
>> >
>> > The select list has values between 1 and 200. Therefore I split it
>up for
>> > every 25th value.
>>
>> Ok, but why?
>
>
>I will use my application on iPad and find it more easy to use multiple
>select lists than one big list with all 200 values at once.
>
>Karl

Can't you just use a number field, which is a hell of a lot easier (especially 
on an iPad) to use than a bunch of select lists.
Thanks,
Ash

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



Re: [PHP] Can this work?

2013-07-05 Thread Stuart Dallas
On 5 Jul 2013, at 15:24, Karl-Arne Gjersøyen  wrote:

> 2013/7/5 Stuart Dallas 
> 
>> On 5 Jul 2013, at 15:05, Karl-Arne Gjersøyen  wrote:
>> 
>>> 2013/7/5 Stuart Dallas 
>>> 
 On 5 Jul 2013, at 14:56, Karl-Arne Gjersøyen 
>> wrote:
 
> Hello. I have a form in HTML/PHP with for loops that generate a
>> selected
> list like this:
> for($i = 1; $i< 25;$i++ ){
> 
> }
> 
> The lists look like this:
> 
> http://localhost/%7Ekarl/kasen/io/kp/index.php>"
> method="post"> value="1-25" selected="selected">1-25 value="1">12 value="3">34 value="5">56 value="7">78 value="9">910 value="11">1112 value="13">1314 value="15">1516 value="17">1718 value="19">1920 value="21">2122 value="23">2324 value="25">25 Kg  name="valgt_dynamit_polse_26-50kg"> selected="selected">26-50 value="26">2627 value="28">2829 value="30">3031 value="32">3233 value="34">3435 value="36">3637 value="38">3839 value="40">4041 value="42">4243 value="44">4445 value="46">4647 value="48">4849 value="50">50 Kg 
> 
> What I try to do with it is to register the selected value and do
 something
> with it. The lists is weight in KG. I hope to select only one value
 between
> 1-25kg OR 26-50kg. I don't know if this is possible? What do you think?
 
 If the range of acceptable values is 1-50, why do you have two select
 fields instead of one?
>>> 
>>> The select list has values between 1 and 200. Therefore I split it up for
>>> every 25th value.
>> 
>> Ok, but why?
> 
> 
> I will use my application on iPad and find it more easy to use multiple
> select lists than one big list with all 200 values at once.

In that case I would recommend using a text input field and validate it with 
javascript and then validate it again on the server-side with PHP. With 
multiple select fields the only way you'll know which one the user (i.e. you) 
meant is by resetting the others to an empty value whenever one of them changes.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can this work?

2013-07-05 Thread Karl-Arne Gjersøyen
2013/7/5 Stuart Dallas 

> On 5 Jul 2013, at 15:05, Karl-Arne Gjersøyen  wrote:
>
> > 2013/7/5 Stuart Dallas 
> >
> >> On 5 Jul 2013, at 14:56, Karl-Arne Gjersøyen 
> wrote:
> >>
> >>> Hello. I have a form in HTML/PHP with for loops that generate a
> selected
> >>> list like this:
> >>> for($i = 1; $i< 25;$i++ ){
> >>> 
> >>> }
> >>>
> >>> The lists look like this:
> >>>
> >>> http://localhost/%7Ekarl/kasen/io/kp/index.php>"
> >>> method="post"> >>> value="1-25" selected="selected">1-25 >>> value="1">12 >>> value="3">34 >>> value="5">56 >>> value="7">78 >>> value="9">910 >>> value="11">1112 >>> value="13">1314 >>> value="15">1516 >>> value="17">1718 >>> value="19">1920 >>> value="21">2122 >>> value="23">2324 >>> value="25">25 Kg  >>> name="valgt_dynamit_polse_26-50kg"> >>> selected="selected">26-50 >>> value="26">2627 >>> value="28">2829 >>> value="30">3031 >>> value="32">3233 >>> value="34">3435 >>> value="36">3637 >>> value="38">3839 >>> value="40">4041 >>> value="42">4243 >>> value="44">4445 >>> value="46">4647 >>> value="48">4849 >>> value="50">50 Kg 
> >>>
> >>> What I try to do with it is to register the selected value and do
> >> something
> >>> with it. The lists is weight in KG. I hope to select only one value
> >> between
> >>> 1-25kg OR 26-50kg. I don't know if this is possible? What do you think?
> >>
> >> If the range of acceptable values is 1-50, why do you have two select
> >> fields instead of one?
> >
> > The select list has values between 1 and 200. Therefore I split it up for
> > every 25th value.
>
> Ok, but why?


I will use my application on iPad and find it more easy to use multiple
select lists than one big list with all 200 values at once.

Karl


Re: [PHP] Can this work?

2013-07-05 Thread Stuart Dallas
On 5 Jul 2013, at 15:05, Karl-Arne Gjersøyen  wrote:

> 2013/7/5 Stuart Dallas 
> 
>> On 5 Jul 2013, at 14:56, Karl-Arne Gjersøyen  wrote:
>> 
>>> Hello. I have a form in HTML/PHP with for loops that generate a selected
>>> list like this:
>>> for($i = 1; $i< 25;$i++ ){
>>> 
>>> }
>>> 
>>> The lists look like this:
>>> 
>>> http://localhost/%7Ekarl/kasen/io/kp/index.php>"
>>> method="post">>> value="1-25" selected="selected">1-25>> value="1">12>> value="3">34>> value="5">56>> value="7">78>> value="9">910>> value="11">1112>> value="13">1314>> value="15">1516>> value="17">1718>> value="19">1920>> value="21">2122>> value="23">2324>> value="25">25 Kg >> name="valgt_dynamit_polse_26-50kg">>> selected="selected">26-50>> value="26">2627>> value="28">2829>> value="30">3031>> value="32">3233>> value="34">3435>> value="36">3637>> value="38">3839>> value="40">4041>> value="42">4243>> value="44">4445>> value="46">4647>> value="48">4849>> value="50">50 Kg 
>>> 
>>> What I try to do with it is to register the selected value and do
>> something
>>> with it. The lists is weight in KG. I hope to select only one value
>> between
>>> 1-25kg OR 26-50kg. I don't know if this is possible? What do you think?
>> 
>> If the range of acceptable values is 1-50, why do you have two select
>> fields instead of one?
> 
> The select list has values between 1 and 200. Therefore I split it up for
> every 25th value.

Ok, but why?

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can this work?

2013-07-05 Thread Karl-Arne Gjersøyen
2013/7/5 Tedd Sperling 

> On Jul 5, 2013, at 9:56 AM, Karl-Arne Gjersøyen 
> wrote:
> > The lists look like this:
> >
> > http://localhost/%7Ekarl/kasen/io/kp/index.php>"
> > method="post"> > value="1-25" selected="selected">1-25 > value="1">12
>
> Review this:
>
> http://sperling.com/php/select/
>
> Also, omit 'multiple' in the select statement.
>
> Other than that, the demo shows how to gather the information you want.
>
> Cheers,
>
> tedd
>
> _
> tedd.sperl...@gmail.com
> http://sperling.com


Thank you very much! 


Re: [PHP] Can this work?

2013-07-05 Thread Karl-Arne Gjersøyen
2013/7/5 Stuart Dallas 

> On 5 Jul 2013, at 14:56, Karl-Arne Gjersøyen  wrote:
>
> > Hello. I have a form in HTML/PHP with for loops that generate a selected
> > list like this:
> > for($i = 1; $i< 25;$i++ ){
> > 
> > }
> >
> > The lists look like this:
> >
> > http://localhost/%7Ekarl/kasen/io/kp/index.php>"
> > method="post"> > value="1-25" selected="selected">1-25 > value="1">12 > value="3">34 > value="5">56 > value="7">78 > value="9">910 > value="11">1112 > value="13">1314 > value="15">1516 > value="17">1718 > value="19">1920 > value="21">2122 > value="23">2324 > value="25">25 Kg  > name="valgt_dynamit_polse_26-50kg"> > selected="selected">26-50 > value="26">2627 > value="28">2829 > value="30">3031 > value="32">3233 > value="34">3435 > value="36">3637 > value="38">3839 > value="40">4041 > value="42">4243 > value="44">4445 > value="46">4647 > value="48">4849 > value="50">50 Kg 
> >
> > What I try to do with it is to register the selected value and do
> something
> > with it. The lists is weight in KG. I hope to select only one value
> between
> > 1-25kg OR 26-50kg. I don't know if this is possible? What do you think?
>
> If the range of acceptable values is 1-50, why do you have two select
> fields instead of one?


The select list has values between 1 and 200. Therefore I split it up for
every 25th value.

Karl


Re: [PHP] Can this work?

2013-07-05 Thread Tedd Sperling
On Jul 5, 2013, at 9:56 AM, Karl-Arne Gjersøyen  wrote:
> The lists look like this:
> 
> http://localhost/%7Ekarl/kasen/io/kp/index.php>"
> method="post"> value="1-25" selected="selected">1-25 value="1">12http://sperling.com/php/select/

Also, omit 'multiple' in the select statement.

Other than that, the demo shows how to gather the information you want.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can this work?

2013-07-05 Thread Stuart Dallas
On 5 Jul 2013, at 14:56, Karl-Arne Gjersøyen  wrote:

> Hello. I have a form in HTML/PHP with for loops that generate a selected
> list like this:
> for($i = 1; $i< 25;$i++ ){
> 
> }
> 
> The lists look like this:
> 
> http://localhost/%7Ekarl/kasen/io/kp/index.php>"
> method="post"> value="1-25" selected="selected">1-25 value="1">12 value="3">34 value="5">56 value="7">78 value="9">910 value="11">1112 value="13">1314 value="15">1516 value="17">1718 value="19">1920 value="21">2122 value="23">2324 value="25">25 Kg  name="valgt_dynamit_polse_26-50kg"> selected="selected">26-50 value="26">2627 value="28">2829 value="30">3031 value="32">3233 value="34">3435 value="36">3637 value="38">3839 value="40">4041 value="42">4243 value="44">4445 value="46">4647 value="48">4849 value="50">50 Kg 
> 
> What I try to do with it is to register the selected value and do something
> with it. The lists is weight in KG. I hope to select only one value between
> 1-25kg OR 26-50kg. I don't know if this is possible? What do you think?

If the range of acceptable values is 1-50, why do you have two select fields 
instead of one?





-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Can this work?

2013-07-05 Thread Karl-Arne Gjersøyen
Hello. I have a form in HTML/PHP with for loops that generate a selected
list like this:
for($i = 1; $i< 25;$i++ ){
 
}

The lists look like this:

http://localhost/%7Ekarl/kasen/io/kp/index.php>"
method="post">1-2512345678910111213141516171819202122232425 Kg 26-5026272829303132333435363738394041424344454647484950 Kg 

What I try to do with it is to register the selected value and do something
with it. The lists is weight in KG. I hope to select only one value between
1-25kg OR 26-50kg. I don't know if this is possible? What do you think?

Thanks.
Karl


Re: [PHP] Web dev, DB and "proper db design".

2013-07-05 Thread Lester Caine

Tony Marston wrote:

Certainly in some instances then managing everything in code makes sense.
Cross database working for instance. So everything works the same for each
engine. But the main advantage of adding constraints in the database is that
it protects the foreign entries from being deleted while they are still in
use. One of the problems I end up having to recover is where a hickup in the
PHP or user side of things has deleted an entry, or more usually the whole
table! In this case a properly implemented constraint would have prevented the
problem. While using a constraint to manage the deletion of detail elements
has a place in reducing traffic between program and database, the protection
of detail elements is the more useful reason for maintaining them.


In my framework I define relationships and any constraints in my data
dictionary, and these are enforced by a standard module in the framework. This
means that any RESTRICTED constraints can be detected in the code without
executing a DELETE and having it abort.


My own database management framework pre-dates PHP switching from dBase 
originally, to Interbase and then Firebird as it was open sourced (just as we 
had paid for a large number of Interbase licenses :( ). So I've grown up using 
the tools in the database, but have to back pedal some of the time where a cross 
database solution is required. I'm much more comfortable with getting the 
database to manage things and will often drop triggers in rather than coding 
that in PHP. So "proper db design"is probably still geared around what we are 
used to rather than any had and fast rules?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Web dev, DB and "proper db design".

2013-07-05 Thread Tony Marston

"Lester Caine"  wrote in message news:51d6987c.9050...@lsces.co.uk...


Tony Marston wrote:
I was designing and building database applications before relational 
databases
became popular, and in those old hierarchical and network databases there 
were
no such things as foreign key constraints. Database integrity had to be 
handled

in the code, which is what we did. When I started working with relational
databases there were features of the language, such as FK constraints, 
which
were rarely used even though they were there. When I started working on 
web
applications the predominant database was MySQL, and the vast majority of 
ISPs
would only offer MyISAM and not Innodb, and MyISAM does not support FK 
constraints.


This was my point about MySQL ... what database were you using before MySQL 
came along?


I used ORACLE and SOLID, and before that Hewlett Packard's IMAGE (network 
DB) and Data General's INFOS (hierarchical DB).


There are some programmers who complain that without foreign keys being 
defined

in the database, how do you recognise relationships to build into SELECT
statements? Simple. Every primary key is in the format ‘_id’, 
so if
you see this format in a table, and  is a different table, 
then it’s
a foreign key. This is actually easier to identify than having to look in 
a

separate place.

Remember that there is a difference between a foreign key and a foreign 
key
constraint. Foreign keys can exist without constraints, so saying that 
you
cannot use a field as a foreign key in a SELECT statement without having 
a

constraint defined in the database is just plain wrong.


Certainly in some instances then managing everything in code makes sense. 
Cross database working for instance. So everything works the same for each 
engine. But the main advantage of adding constraints in the database is 
that it protects the foreign entries from being deleted while they are 
still in use. One of the problems I end up having to recover is where a 
hickup in the PHP or user side of things has deleted an entry, or more 
usually the whole table! In this case a properly implemented constraint 
would have prevented the problem. While using a constraint to manage the 
deletion of detail elements has a place in reducing traffic between program 
and database, the protection of detail elements is the more useful reason 
for maintaining them.


In my framework I define relationships and any constraints in my data 
dictionary, and these are enforced by a standard module in the framework. 
This means that any RESTRICTED constraints can be detected in the code 
without executing a DELETE and having it abort.


--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org 



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



Re: [PHP] Web dev, DB and "proper db design".

2013-07-05 Thread Lester Caine

Tony Marston wrote:

I was designing and building database applications before relational databases
became popular, and in those old hierarchical and network databases there were
no such things as foreign key constraints. Database integrity had to be handled
in the code, which is what we did. When I started working with relational
databases there were features of the language, such as FK constraints, which
were rarely used even though they were there. When I started working on web
applications the predominant database was MySQL, and the vast majority of ISPs
would only offer MyISAM and not Innodb, and MyISAM does not support FK 
constraints.


This was my point about MySQL ... what database were you using before MySQL came 
along?



There are some programmers who complain that without foreign keys being defined
in the database, how do you recognise relationships to build into SELECT
statements? Simple. Every primary key is in the format ‘_id’, so if
you see this format in a table, and  is a different table, then it’s
a foreign key. This is actually easier to identify than having to look in a
separate place.

Remember that there is a difference between a foreign key and a foreign key
constraint. Foreign keys can exist without constraints, so saying that you
cannot use a field as a foreign key in a SELECT statement without having a
constraint defined in the database is just plain wrong.


Certainly in some instances then managing everything in code makes sense. Cross 
database working for instance. So everything works the same for each engine. But 
the main advantage of adding constraints in the database is that it protects the 
foreign entries from being deleted while they are still in use. One of the 
problems I end up having to recover is where a hickup in the PHP or user side of 
things has deleted an entry, or more usually the whole table! In this case a 
properly implemented constraint would have prevented the problem. While using a 
constraint to manage the deletion of detail elements has a place in reducing 
traffic between program and datbase, the protection of detail elements is the 
more useful reason for maintaining them.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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



Re: [PHP] Web dev, DB and "proper db design".

2013-07-05 Thread Tony Marston
"Tamara Temple"  wrote in message 
news:557a0092-2b7d-49f4-ae3d-593968dd3...@gmail.com...



On Jul 4, 2013, at 8:02 AM, Jim Giner  wrote:


On 7/4/2013 6:42 AM, Richard Quadling wrote:

Hi.

I've just had a conversation regarding DB, foreign keys and their 
benefits.


I was told "I've never worked on a web application where foreign keys 
were

used in the database".

As someone who has spent 25 years working on accounting/epos systems on 
MS

SQL Server (yep, windows) and now in a web environment and hearing the
above, ... well, ... slightly concerned.

So, in the biggest broadest terms, what do you lot do?

DBs with no foreign keys (constrainted or not).
ORM builders with manual definition of relationships between the tables.
Inline SQL where you have to just remember all the relationships.
Views for simple lookups? How do you handle updatable views (does mysql
support them?)
etc.

Is there a difference in those in 'startups' and web only situations, or
those doing more traditional development (split that as you like - I'm 
just

trying to get an understanding and not go off on one!).

No definitive answers, and I hope I get some wide experiences here.

Thanks for looking.

Richard.

I"m going to guess that your source of such drivel never learned about 
such things.  Probably thinks that a 'key' has to be defined as such in 
the db, whereas we know what a FK really is.


Don't worry.  As a former big iron guy and then a c/s guy and now a (new) 
web guy, things haven't changed.


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



So, like Jim, I'm just going to speculate your correspondent has never 
actually designed
anything very interesting. I can't really imagine how one does not use 
foreign keys,
unless one does the entire relationship mapping between tables in the 
source… what

a waste that would be.


"Tamara Temple"  wrote in message 
news:557a0092-2b7d-49f4-ae3d-593968dd3...@gmail.com...



On Jul 4, 2013, at 8:02 AM, Jim Giner  wrote:


On 7/4/2013 6:42 AM, Richard Quadling wrote:

Hi.

I've just had a conversation regarding DB, foreign keys and their 
benefits.


I was told "I've never worked on a web application where foreign keys 
were

used in the database".

As someone who has spent 25 years working on accounting/epos systems on 
MS

SQL Server (yep, windows) and now in a web environment and hearing the
above, ... well, ... slightly concerned.

So, in the biggest broadest terms, what do you lot do?

DBs with no foreign keys (constrainted or not).
ORM builders with manual definition of relationships between the tables.
Inline SQL where you have to just remember all the relationships.
Views for simple lookups? How do you handle updatable views (does mysql
support them?)
etc.

Is there a difference in those in 'startups' and web only situations, or
those doing more traditional development (split that as you like - I'm 
just

trying to get an understanding and not go off on one!).

No definitive answers, and I hope I get some wide experiences here.

Thanks for looking.

Richard.

I"m going to guess that your source of such drivel never learned about 
such things.  Probably thinks that a 'key' has to be defined as such in 
the db, whereas we know what a FK really is.


Don't worry.  As a former big iron guy and then a c/s guy and now a (new) 
web guy, things haven't changed.


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



So, like Jim, I'm just going to speculate your correspondent has never 
actually designed
anything very interesting. I can't really imagine how one does not use 
foreign keys,
unless one does the entire relationship mapping between tables in the 
source… what a

waste that would be.=


I was designing and building database applications before relational 
databases became popular, and in those old hierarchical and network 
databases there were no such things as foreign key constraints. Database 
integrity had to be handled in the code, which is what we did. When I 
started working with relational databases there were features of the 
language, such as FK constraints, which were rarely used even though they 
were there. When I started working on web applications the predominant 
database was MySQL, and the vast majority of ISPs would only offer MyISAM 
and not Innodb, and MyISAM does not support FK constraints.


There are some programmers who complain that without foreign keys being 
defined in the database, how do you recognise relationships to build into 
SELECT statements? Simple. Every primary key is in the format 
‘_id’, so if you see this format in a table, and  is a 
different table, then it’s a foreign key. This is actually easier to 
identify than having to look in a separate place.


Remember that there is a difference between a foreign key and a foreign key 
constraint. Foreign keys can exist without constraints, so saying that you 
cannot use a field a