You are here: Re: Learning php Sql - « PHP SQL « IT news, forums, messages
Re: Learning php Sql -

Posted by J.O. Aho on 10/14/04 11:50

Frankly wrote:

> no offense taken but i do feel bad. this is my first time building a
> database.

Most of your doings are good and first time is learning, next time you will
make an excellent job.

> i know
> that has nothing to do with my putting varchars where I should have known
> and do know to put INT - i have no excuse and can understand your thinking
> HTH. i think i put varchar when i thought it was going to be Yes or No, but
> also be to honest I am a bit confused because i thought as long as you wont
> be using numbers for calculations varchar can be used.

It's faster to use 0 for NO, 1 for YES, it takes longer time to compare string
than compare values and you get an easier syntax

if($intval) {
/* the $intval is a value bigger or less than 0 - we got a yes */
} else {
/* the $intval is 0, we got a no */
}

compared to

if(strcmp(strtolower($string),"yes")==0) {
/* we have a yes */
} else if(strcmp(strtolower($string),"no")==0) {
/* we got a no */
}

For a multi option, you could do

switch(intval) {
case 0:
/* We have a no */
break;
case 1:
/* We have a yes */
break;
default:
/* We got something else, so we will tell we don't know */
break;
}

of course you can do the switch and use strings, but comparing string takes
always more time than comparing values.


> i wish i didnt bother looking into all that MS and Coldfusion stuff. I
> should have just jumped in and did this when that tutorial was fresh in my
> head. Still is no excuse for some of the mistakes I have been making.

We all make mistakes, that's what makes us humans.
There can be many good ideas in the coldfusion tutorials that you can have use
of too, so I won't say it's a mistake to read it.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация