Re: [nyphp-talk] naming identifiers

2009-08-29 Thread li...@nopersonal.info
Hi Dan, Daniel Convissor wrote: > Your big mistake was delimiting the identifiers when creating the table. > > "Identifiers" are table names, field names, index names, etc. The > "delimiter" for these is "`" in MySQL. When you use the delimiter around > the identifiers, the database allows yo

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread Eddie Drapkin
On Sat, Aug 29, 2009 at 6:21 PM, Hans Zaunere wrote: > Yeah something like this could be handy, certainly.  I typically push/adapt > an object into the template which is property overloaded.  Then something > like: > > FirstName?> > > Outputs correctly escaped (or processed in any other way dependi

Re: [nyphp-talk] Working with designers

2009-08-29 Thread Ajai Khattri
On Thu, 27 Aug 2009, tedd wrote: > I know what you mean. For me, clients basically fall into two groups: > a) Those who tell me what they want; b) And those who tell me how to > do what they want. I work well with (a), but have problems with (b). Should there also be (c) people who dont really

Re: [nyphp-talk] Working with designers

2009-08-29 Thread Ajai Khattri
On Wed, 26 Aug 2009, li...@nopersonal.info wrote: > I suppose that's partly because designers' creativity is by nature > visually oriented, whereas programming requires more of a... I'm not > sure what to call it... maybe creativity of logic? It requires mental visualization of abstract concepts

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread David Krings
li...@nopersonal.info wrote: Okay, wait--but what about what Dan said re NULL values not being added to averages, making them useful statistically? In that case wouldn't you want NULL to stay NULL? IOW, in his case the query would would only retrieve values WHERE foo != NULL? But then the manual

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Daniel Convissor
Folks: On Sat, Aug 29, 2009 at 07:09:05PM -0700, Kristina D. H. Anderson wrote: > >>But in the case of a form, wouldn't you be validating the input before > >>trying to insert the record? Sorry if I seem dense--I must be > >>misunderstanding something. > > No, you are exactly right, and you'll wa

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Hans Zaunere
> I don't usually use NULL values for anything because no matter how much > I read I can't figure out the purpose of it. So far this hasn't been a > problem for me, but I figure it's going to trip me up sooner or later. NULL is just a type - a type that can only ever be one thing - NULL > I've re

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Daniel Convissor
Heya: > In sql, every comparison to NULL, yields another NULL. > That is why 'SELECT * WHERE foo = NULL' doesn't do what you might > expect. In fact that query is guaranteed to always return zero rows. When you want to get rows where foo really is null, you need to need to use "is null": SE

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
Michael Southwell wrote: > Precisely this issue is discussed in the PHundamental article > http://www.nyphp.org/phundamentals/variableevaluation.php (which picks > up a contemporaneous thread ;-). Wow, that's a great article. I don't know how I overlooked it. Bev ___

Re: [nyphp-talk] naming identifiers (was: understanding NULL)

2009-08-29 Thread Kristina D. H. Anderson
>Your big mistake was delimiting the identifiers when creating the table. > > "Identifiers" are table names, field names, index names, etc. The > "delimiter" for these is "`" in MySQL. When you use the delimiter around > the identifiers, the database allows you to create nearly any name you

[nyphp-talk] naming identifiers (was: understanding NULL)

2009-08-29 Thread Daniel Convissor
Hi Bev: > Creating a field/variable named desc and spending hours trying to figure > out why MySQL was balking at my query with its typically enigmatic error > messages. Your big mistake was delimiting the identifiers when creating the table. "Identifiers" are table names, field names, index nam

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
Kristina D. H. Anderson wrote: >>> But in the case of a form, wouldn't you be validating the input before >>> trying to insert the record? Sorry if I seem dense--I must be >>> misunderstanding something. > > No, you are exactly right, and you'll want to use a combination of > client-side (form) v

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Kristina D. H. Anderson
The fun part is when you inherit a database that's such a mess that your "empty" fields are either NULLs, or ''s, OR even ' 's. And of course all the boolean fields use 0 for true and 1 for false...just to really make your day. Real-world programming scenarios!! Kristina > John Campbell w

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Michael Southwell
John Campbell wrote: In sql, every comparison to NULL, yields another NULL. That is why 'SELECT * WHERE foo = NULL' doesn't do what you might expect. In fact that query is guaranteed to always return zero rows. which is why the correct syntax for such a select would have to be 'SELECT * [FROM

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
John Campbell wrote: > You should be aware that PHP and SQL have completely different concepts of > null. > > In php, null is a unique magic value that means "undefined", and if > two things are null, then they are equal. > In a SQL view of the world, that can be interpreted as: > Are two not

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Kristina D. H. Anderson
>>But in the case of a form, wouldn't you be validating the input before >>trying to insert the record? Sorry if I seem dense--I must be >>misunderstanding something. No, you are exactly right, and you'll want to use a combination of client-side (form) validation and good database design, and mak

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread John Campbell
You should be aware that PHP and SQL have completely different concepts of null. In php, null is a unique magic value that means "undefined", and if two things are null, then they are equal. http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show_participation.php

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Michael Southwell
Kristina D. H. Anderson wrote: You're right that in PHP most of the comparison operators won't treat an empty string and NULL pulled out of a database as the same. I'm thinking back on a long history of using many languages and have to say that without sitting down and testing it out, I couldn

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
tedd wrote: > Null is an odd critter. Indeed. > Try reading this: > > http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html Actually, that's precisely what I was reading before I posted here. I had once again been trying to comprehend NULL and had hoped that rereading the manual pages

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
Kristina D. H. Anderson wrote: > Let's take a basic example, you design a database table and you > describe your LastName field as NOT NULL. > > That means that every time you do an insert into the table, the field > LastName MUST contain a value of some sort. The purpose of that is > basicall

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
David, thanks for the detailed explanation & examples. David Krings wrote: > That said, I think it is very important to initialize every variable you > use in your script right at the beginning of the script, even if you > never will use the variable with that value. The reason for that is that >

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
Andy Dirnberger wrote: > Before querying the database, I check to see if the result of the > query has been cached. I call a function that will either return the > value in the cache or null, either because the cache has expired or > because it was never set. When I receive a return value other t

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread tedd
At 4:33 PM -0400 8/29/09, li...@nopersonal.info wrote: Daniel Convissor wrote: This is useful, in part, for statistical purposes, since the null record won't be added into averages, etc. For example, you had three surveys filled out. Two people actually filled in their ages (10 and 20), if

Re: [nyphp-talk] OOP, Frameworks, ONLAMP, and NYPHP

2009-08-29 Thread li...@nopersonal.info
Hans Zaunere wrote: >> I can't offer much in the way of expertise, but I can certainly offer my >> time. It's the least I can do considering what a great resource this >> list has been. The way I see it, helping out in some capacity would not >> only allow me to give back a little, but would also a

Re: [nyphp-talk] OOP, Frameworks, ONLAMP, and NYPHP

2009-08-29 Thread Hans Zaunere
> > Regarding PHundamentals, it's certainly been a great resource over the years > > thanks to the time and effort put into it, and the quality/participation of > > the list members. > > > > It has, obviously, stalled and become a bit outdated itself. Picking them > > back up would be a great thin

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread Hans Zaunere
> > Absolutely, some type of shorthand is needed, which is exactly why they > > exist in the first place. I think the issue with removing > one could decide what to actually replace it with. It'll come, wait for > > it... > > Well you're at it, how about a version of htmlspecialchars() built i

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Kristina D. H. Anderson
David, Thanks for this, and I can't cut & paste and quote you because your email got encoded by my webmail. You're right that in PHP most of the comparison operators won't treat an empty string and NULL pulled out of a database as the same. I'm thinking back on a long history of using many la

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Kristina D. H. Anderson
Bev, The test for and behavior of NULL varies somewhat from language to language and database to database. Let's take a basic example, you design a database table and you describe your LastName field as NOT NULL. That means that every time you do an insert into the table, the field LastName M

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread David Krings
li...@nopersonal.info wrote: I don't usually use NULL values for anything because no matter how much I read I can't figure out the purpose of it. So far this hasn't been a problem for me, but I figure it's going to trip me up sooner or later. I've read the NULL sections of the PHP & MySQL manual

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Andy Dirnberger
On Sat, Aug 29, 2009 at 4:33 PM, li...@nopersonal.info wrote: > > If anyone else has practical examples, please don't hold back. > Here's an example of one instance in which I use null. Before querying the database, I check to see if the result of the query has been cached. I call a function tha

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
Daniel Convissor wrote: > This is useful, in part, for statistical purposes, since the null record > won't be added into averages, etc. For example, you had three surveys > filled out. Two people actually filled in their ages (10 and 20), if you > do an average when using nulls, you'll get an

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
Matt Juszczak wrote: > something is NULL, then you don't know what it is. It could be empty, > or it could be set. You just don't know. That's precise the part I can't seem to wrap my head around. > If something is empty, then you know it's empty. So if birthdate is set > to '', then you know

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Daniel Convissor
Hey Bev: > but the concept of a ???a missing unknown value??? > makes my brain hurt. Let's say you wrote a piece of software that asks users a set of questions. Before a user responds to a given question, its answer field is null. When they answer the question, its field gets assigned the ac

Re: [nyphp-talk] Need help understanding NULL

2009-08-29 Thread Matt Juszczak
Bev, This might potentially be wrong, but what I think of NULL is this. If something is NULL, then you don't know what it is. It could be empty, or it could be set. You just don't know. If something is empty, then you know it's empty. So if birthdate is set to '', then you know they have

[nyphp-talk] Need help understanding NULL

2009-08-29 Thread li...@nopersonal.info
I don't usually use NULL values for anything because no matter how much I read I can't figure out the purpose of it. So far this hasn't been a problem for me, but I figure it's going to trip me up sooner or later. I've read the NULL sections of the PHP & MySQL manuals and even tried googling for a

Re: [nyphp-talk] OOP, Frameworks, ONLAMP, and NYPHP

2009-08-29 Thread li...@nopersonal.info
Hans Zaunere wrote: > Regarding PHundamentals, it's certainly been a great resource over the years > thanks to the time and effort put into it, and the quality/participation of > the list members. > > It has, obviously, stalled and become a bit outdated itself. Picking them > back up would be a g

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread John Campbell
On Sat, Aug 29, 2009 at 5:07 AM, Justin Hileman wrote: > > For bonus points, I'm a fan of something this: > > function _($string) { echo htmlspecialchars(l10n($string)); } > Be careful... _() is already defined as an alias for gettext() I have a feeling that would cause a ton of compatibility iss

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread David Krings
Chris Snyder wrote: On Fri, Aug 28, 2009 at 3:33 PM, Eddie Drapkin wrote: It's snippets like these, imho, that justify the deprecation/removal of short open tags. Well, everyone is entitled to their opinion. I'd much rather type than . Since I have an opinion as well I think it isn't unre

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread Mona Borham
the problem is the same if you are working in multiple language support in your hosting server Mona Web Developer On Sat, Aug 29, 2009 at 7:05 PM, Ajai Khattri wrote: > On Fri, 28 Aug 2009, Hans Zaunere wrote: > > > Absolutely, some type of shorthand is needed, which is exactly why they > > exi

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread Ajai Khattri
On Fri, 28 Aug 2009, Hans Zaunere wrote: > Absolutely, some type of shorthand is needed, which is exactly why they > exist in the first place. I think the issue with removing one could decide what to actually replace it with. It'll come, wait for > it... How about <% and %> - just like ASP :-

Re: [nyphp-talk] Dynamically Add Links to Text

2009-08-29 Thread tedd
At 4:45 PM -0400 8/28/09, Chuck Reeves wrote: On more solution would be to have a roll over the word/phrase that will present the user with a list of articles matching that title. This way for the Americas problem, the user can then choose which article s/he would like to goto instead of lettin

Re: [nyphp-talk] Dynamically Add Links to Text

2009-08-29 Thread tedd
Title: Re: [nyphp-talk] Dynamically Add Links to Text At 10:11 PM +0300 8/28/09, Petros Ziogas wrote: Hi Tedd, That were some good ideas about the problems that I thought will arise. What you forgeting is that you can't just decide what is more important and what is not. I mean it might be that

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread tedd
At 3:50 PM -0400 8/28/09, Chris Snyder wrote: On Fri, Aug 28, 2009 at 3:33 PM, Eddie Drapkin wrote: It's snippets like these, imho, that justify the deprecation/removal of short open tags. Well, everyone is entitled to their opinion. I'd much rather type than . It all comes down to what y

Re: [nyphp-talk] Short Tags deprecated?

2009-08-29 Thread Justin Hileman
Paul A Houle wrote: It might be an irresponsible namespace grab, but I've got a function that is (almost) function Q($s) { echo htmlspecialchars($s) }; and I get into the habit of writing in my templates so I'm not writing hundreds of HTML injection bugs all day.. For bonus points,