php-general Digest 10 Aug 2009 11:17:55 -0000 Issue 6277

Topics (messages 296525 through 296542):

Re: PHP programming strategy
        296525 by: tedd
        296526 by: Eddie Drapkin

Re: MySQL auto_increment fields Server version: 5.1.32-community-log
        296527 by: Ralph Deffke
        296528 by: Ralph Deffke
        296529 by: Ralph Deffke
        296542 by: tedd

Re: use preg_replace to nix and line with "display: none"
        296530 by: Ben Dunlap

reason for a "Notice:.." on one site but not another?  (Same code.)
        296531 by: John Butler
        296532 by: Mari Masuda
        296533 by: James Colannino
        296534 by: Ben Dunlap
        296535 by: Bastien Koert
        296536 by: Bastien Koert
        296537 by: John Butler
        296539 by: Shawn McKenzie
        296540 by: John Butler

Re: Question: what are frameworks?
        296538 by: Sancar Saran

Re: Radio buttons problem
        296541 by: leledumbo

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
At 1:05 PM +0100 8/9/09, Ashley Sheridan wrote:
On Sun, 2009-08-09 at 07:55 -0400, tedd wrote:

 > But, as it was said, IE's have problems with first-child rules.


How does IE8 fare with selectors in CSS?

Thanks,
Ash

tedd = clue--

or

tedd < clue

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Sun, Aug 9, 2009 at 6:33 PM, tedd<tedd.sperl...@gmail.com> wrote:
> At 1:05 PM +0100 8/9/09, Ashley Sheridan wrote:
>>
>> On Sun, 2009-08-09 at 07:55 -0400, tedd wrote:
>>
>>  > But, as it was said, IE's have problems with first-child rules.
>>>
>>
>> How does IE8 fare with selectors in CSS?
>>
>> Thanks,
>> Ash
>
> tedd = clue--
>
> or
>
> tedd < clue
>
> tedd
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

IE8 is the most CSS2 standards compliant browser, if I recall they
submitted 5 or 6 dozen tests to the w3c that they were the only
browser that passed.  As far as selectors go:
http://msdn.microsoft.com/en-us/library/cc351024%28VS.85%29.aspx#selectors
looks to me like they're fully compliant with CSS2.1.

--- End Message ---
--- Begin Message ---
I would like to have a KNOWN status of my database after a NEW installation
of the application, because the further installation relais on information
stored in record 1 of each table.

"tedd" <tedd.sperl...@gmail.com> wrote in message
news:p06240801c6a4fe331...@[192.168.1.100]...
> At 8:17 PM +0200 8/9/09, Ralph Deffke wrote:
> >Hi all,
> >
> >I'm facing the fact that it seems that auto_increment fields in a table
not
> >start at 1 like it was in earlier versions even if I install mySQL brand
new
> >creating all tables new. it seems to me that auto_increments handling has
> >changed to older version. is somebody out there who can give me a quick
> >background about auto_increment and how and if I can control the behavior
of
> >mySQL about them.
> >
> >ralph_def...@yahoo.de
>
>
> Why be concerned about it? What difference does it make?
>
> Cheers,
>
> tedd
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com



--- End Message ---
--- Begin Message ---
this is a very good startup for the issue. now the question is where does it
get the value if there is no max(ai) or when I do an insert in an empty
table with the ai field set to 1 where does the innoDB get the next ai value
10720 ?

I assume that the SELECT MAX(ai_col) FROM t FOR UPDATE; return is
incremented by 1 so how does this end up with 10720?

anyway, ur statement shows that there has changed somethimg definately. but
what?
maid be there is some flag telling the kernel that ai fields should be
unique throughout the database? some left behind of the cluster version of
mySQL?


"Nisse Engström" <news.nospam.0ixbt...@luden.se> wrote in message
news:91.f7.55947.dc74f...@pb1.pair.com...
> On Sun, 9 Aug 2009 20:17:15 +0200, "Ralph Deffke" wrote:
>
> > I'm facing the fact that it seems that auto_increment fields in a table
not
> > start at 1 like it was in earlier versions even if I install mySQL brand
new
> > creating all tables new. it seems to me that auto_increments handling
has
> > changed to older version. is somebody out there who can give me a quick
> > background about auto_increment and how and if I can control the
behavior of
> > mySQL about them.
>
> Did you Google for it? I found the following page that
> might be relevant:
>
>
<http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html>
>
>    "Beginning with MySQL 5.1.22, InnoDB provides a locking
>     strategy that significantly improves scalability and
>     performance of SQL statements that add rows to tables
>     with AUTO_INCREMENT columns.
>     ...
>     InnoDB uses the following algorithm to initialize the
>     auto-increment counter for a table t that contains an
>     AUTO_INCREMENT column named ai_col: After a server
>     startup, for the first insert into a table t, InnoDB
>     executes the equivalent of this statement:
>
>       SELECT MAX(ai_col) FROM t FOR UPDATE;
>
>     InnoDB increments by one the value retrieved by the
>     statement and assigns it to the column and to the
>     auto-increment counter for the table."
>
>
> /Nisse



--- End Message ---
--- Begin Message ---
I should mention that I use MyISAM as storage engine what makes it even more
wiered.

"Nisse Engström" <news.nospam.0ixbt...@luden.se> wrote in message
news:91.f7.55947.dc74f...@pb1.pair.com...
> On Sun, 9 Aug 2009 20:17:15 +0200, "Ralph Deffke" wrote:
>
> > I'm facing the fact that it seems that auto_increment fields in a table
not
> > start at 1 like it was in earlier versions even if I install mySQL brand
new
> > creating all tables new. it seems to me that auto_increments handling
has
> > changed to older version. is somebody out there who can give me a quick
> > background about auto_increment and how and if I can control the
behavior of
> > mySQL about them.
>
> Did you Google for it? I found the following page that
> might be relevant:
>
>
<http://dev.mysql.com/doc/refman/5.1/en/innodb-auto-increment-handling.html>
>
>    "Beginning with MySQL 5.1.22, InnoDB provides a locking
>     strategy that significantly improves scalability and
>     performance of SQL statements that add rows to tables
>     with AUTO_INCREMENT columns.
>     ...
>     InnoDB uses the following algorithm to initialize the
>     auto-increment counter for a table t that contains an
>     AUTO_INCREMENT column named ai_col: After a server
>     startup, for the first insert into a table t, InnoDB
>     executes the equivalent of this statement:
>
>       SELECT MAX(ai_col) FROM t FOR UPDATE;
>
>     InnoDB increments by one the value retrieved by the
>     statement and assigns it to the column and to the
>     auto-increment counter for the table."
>
>
> /Nisse



--- End Message ---
--- Begin Message ---
At 12:47 AM +0200 8/10/09, Ralph Deffke wrote:
I would like to have a KNOWN status of my database after a NEW installation
of the application, because the further installation relais on information
stored in record 1 of each table.

Sounds like a problem waiting to happen.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
> > $pattern = '|^.+?display:none.+?$|mi';
[8<]
> I found your use of ? rather... creative...  Anyway, just add the

You mean the non-greedy flag? I think that's necessary the way the
regex was originally formulated -- without it, ".+display" would
gobble up all of the list-items until the last one.

Ben

--- End Message ---
--- Begin Message ---
Hi sunday  coders,

I've been using this kind of logic on one PHP site I work on to display one thing or another depending on whether the form was submitted or not:

                if($_POST['UserWishesDateRange']) {  //--line 79
                        echo'submitted';
                } else {
                        echo'NOT submitted';
                }

and it works great on that site.

But on another site it still works, but gives this error:
Notice: Undefined index: UserWishesDateRange in /home/vs/site/phvs/bl/ 7solarsecrets/admin/trackingcode.html on line 79

I assume that is because the error display settings are set to a more rigorous level in this latter site.
Is this correct?

(Both sites reside on servers where I am not the admin.)

------------
John Butler (Govinda)
govinda.webdnat...@gmail.com




--- End Message ---
--- Begin Message ---

On Aug 9, 2009, at 16:43, John Butler wrote:

Hi sunday  coders,

I've been using this kind of logic on one PHP site I work on to display one thing or another depending on whether the form was submitted or not:

                if($_POST['UserWishesDateRange']) {  //--line 79
                        echo'submitted';
                } else {
                        echo'NOT submitted';
                }

and it works great on that site.

But on another site it still works, but gives this error:
Notice: Undefined index: UserWishesDateRange in /home/vs/site/phvs/ bl/7solarsecrets/admin/trackingcode.html on line 79

I assume that is because the error display settings are set to a more rigorous level in this latter site.
Is this correct?

(Both sites reside on servers where I am not the admin.)

------------
John Butler (Govinda)
govinda.webdnat...@gmail.com


You could do something like:

if(isset($_POST['UserWishesDateRange'])) { //--line 79 or you could use something like !empty($_POST['UserWishesDateRange'])
        echo 'submitted';
} else {
        echo 'NOT submitted';
}

This will check if $_POST['UserWishesDateRange'] is set to something. You are getting the error message because $_POST ['UserWishesDateRange'] is not set if the form is not submitted. The server where you don't get the error message probably just has error reporting turned off.
--- End Message ---
--- Begin Message ---
John Butler wrote:

>         if($_POST['UserWishesDateRange']) {  //--line 79
>             echo'submitted';
>         } else {
>             echo'NOT submitted';
>         }

Try this instead:

if (isset('UserWishesDateRange'])) {
   // [...stuff goes here...]
}

James
-- 
"Black holes are where God divided by zero." --Steven Wright

--- End Message ---
--- Begin Message ---
> But on another site it still works, but gives this error:
> Notice: Undefined index: UserWishesDateRange in
> /home/vs/site/phvs/bl/7solarsecrets/admin/trackingcode.html on line 79
>
> I assume that is because the error display settings are set to a more
> rigorous level in this latter site.
> Is this correct?

It's either the 'error_reporting' configuration directive that's
different between the two servers, or 'display_errors', or both.

On one server the E_NOTICE bit-field is set in 'error_reporting', and
it sounds like 'display_errors' is also set (unless you're seeing that
notice in a log file).

On the other server, one or the other of those things is not set (or
both of them aren't).

You can use call ini_get('error_reporting') and
ini_get('display_errors'), to see what they're set to on each server.
Or just create a small page that only calls phpinfo(), to see all
configuration directives.

Here's the write-up of the directives (one is right below the other):

http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting

As others have pointed out, it's a good idea to call isset() on a
POST-variable before trying to get at its value. This will avoid a
notice being thrown.

Lately I've stopped touching $_POST directly and started using
filter_input() instead; this also avoids the problem and provides
several other benefits:

http://us2.php.net/manual/en/function.filter-input.php

The filter_* functions are only available in core since 5.2.0, though.

Ben

--- End Message ---
--- Begin Message ---
Bastien

Sent from my iPod

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---




On Aug 9, 2009, at 7:43 PM, John Butler <govinda.webdnat...@gmail.com> wrote:

Hi sunday  coders,

I've been using this kind of logic on one PHP site I work on to display one thing or another depending on whether the form was submitted or not:



and it works great on that site.

But on another site it still works, but gives this error:
Notice: Undefined index: in /home/vs/site/phvs/bl/7solarsecrets/ admin/trackingcode.html on line 79

I assume that is because the error display settings are set to a more rigorous level in this latter site.
Is this correct?

(Both sites reside on servers where I am not the admin.)

------------
John Butler (Govinda)
govinda.webdnat...@gmail.com




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


You could also simply define / initialize the variable.

$UserWishesDateRange='';
if($_POST['UserWishesDateRange']) {  //--line 79
           echo'submitted';
       } else {
           echo'NOT submitted';
       }





Bastien

Sent from my iPod

--- End Message ---
--- Begin Message ---
http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting

Thank you guys for the isset() heads up. And Ben, for this good explanation of error reporting!

As others have pointed out, it's a good idea to call isset() on a
POST-variable before trying to get at its value. This will avoid a
notice being thrown.

OK, and I can work around all this anyway, but I would love to get it all in one line of code, that essentially says: (pseudocode)
if  ($IamNotEmpty && $IamEqualto='T') {
(where those are both the same var)


http://us2.php.net/manual/en/function.filter-input.php
The filter_* functions are only available in core since 5.2.0, though.

OK, ..good to plant seeds, but since that server is PHP 4.3, I'll save my brain now for until I can actually integrate that study.

------------
John Butler (Govinda)
govinda.webdnat...@gmail.com




--- End Message ---
--- Begin Message ---
John Butler wrote:
>> http://us3.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting
>>
> 
> Thank you guys for the isset() heads up.  And Ben, for this good
> explanation of error reporting!
> 
>> As others have pointed out, it's a good idea to call isset() on a
>> POST-variable before trying to get at its value. This will avoid a
>> notice being thrown.
> 
> OK, and I can work around all this anyway, but I would love to get it
> all in one line of code, that essentially says: (pseudocode)
> if  ($IamNotEmpty && $IamEqualto='T') {
> (where those are both the same var)

if(isset($_POST['UserWishesDateRange']) && $_POST['UserWishesDateRange']
== 'T') {

-- or  --

$uwdr = $_POST['UserWishesDateRange'];

if(isset($uwdr) && $uwdr == 'T') {

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
if(isset($_POST['UserWishesDateRange']) && $_POST['UserWishesDateRange']
== 'T') {


Thought I tried that. Apparently not exactly; it works now! Thanks. I know it is clunky but I wanted to see how compact it could be done.
--- End Message ---
--- Begin Message ---
On Sunday 09 August 2009 02:47:37 pm Parham Doustdar wrote:
> Hi there,
> I've heard of frameworks, but I don't quite know what they are used for.
> I've done a little search on the internet, but even though I've been able
> to find different PHP frameworks, I'm not quite sure what they offer, or in
> what they differ, or why I shouldn't just use PHP as it is. Can someone
> give a little bit of explaination?
> Thanks!

They are the different way of the programming php.

PHP is the Temple Of the Shaolin, those fw programmers are master of the 
techniques. 

They are generate their way of the PHP-FU. Like kung-fu there are many ways to 
do things in php. 

From my point of view. All of them sh*t load of bloated code masterpieces. 

After RoR craze, Nearly every PHP developer sees the light in a one night. 
Then PHP Frameworks was skyrocketed. And Zend jump the bandwagon.

Main point of Framework craze was not technical. PHP was loose type language, 
you can easily mess up your self in seconds and in the Internet you can see 
giantic size of spagetti code. Because of this, Java and .net programmers 
constantly mauls PHP as non enterprise language.

So ? What is the point ? The point is, As a company owner or the project 
manager when you get a Certified this or that framework master, you can easily 
adopt a standard to your projects, plus, you can get support and more 
important than that you can show your badges and whistles to your customer to 
prove yourself as a Experienced php crafter.

In simple, They says to your customer, you are in safe, these guys knows php, 
you can buy things from them even if they blows things up, you can find another 
certified master somewhere else.

From my point of view.

If you want to learn a Framework, I suggest you to learn a CMS/Framework, 
something like TYPO3.

Because, after installing learning maybe certifying a framework, you have to 
do tons of coding to generate a usable platform. For example you have to write 
a session controller, have to generate a administrator interface, this that 
yada yada.

So why you have to do all of this. Use a CMS/Framework and do just you need.

Plus, TYPO3 also has same badges and whistles (if you wish) for your 
customers. Even in Germany it has bigger balls too.

Regards

--- End Message ---
--- Begin Message ---
> Why do you? There's no reason you *have* to have consecutive indexes --
just iterate over the resulting > array with foreach, and there's no
problem.

There is, the entries are grouped by its index. So, I group name[0],
email[0], and sex[0] as one. The problem if I don't maintain the index for
radio buttons, the index could go wrong.

In the previous example I gave, if entry2 is deleted (and I don't maintain
the index) then entry3 will contain name[1], email[1], and sex[2] which
isn't desirable.
-- 
View this message in context: 
http://www.nabble.com/Radio-buttons-problem-tp24786766p24897287.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---

Reply via email to