[PHP] Re: Hmmm.. I think I need your advice here to get in correct direction...
On 7/10/2013 8:30 AM, Karl-Arne Gjersøyen wrote: I am almost ready with my learning project in PHP/MySQL. I can register new product in stock. Add and increase the number and weight. I can move products between different storehouses I can also transfer products from store and onto a "truck document" but that's it and here I need some advice. I like to register new products and the amount in number (for example 4) and weight in kg. I like to write it in this way: Dynamite - package 4 - Weight 200 kg Lunt - Package 10 Show us your code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hmmm
Jason Bennett wrote: I just installed a new MYSQL version 4.1 (from 4.0) and now none of my PHP scripts work anymore. They are all complaining about attempting to login as root. Normally, I referance a class like: Not a MySQL user, but don't you have to change drivers between 4.0 and 4.1 - the security system changed, so you need the php_mysqli driver? http://uk2.php.net/manual/en/ref.mysqli.php -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hmmm?
> Why you ppl. do this: > if ($condition) { > file://action 1 > file://action 2 > file://action 3 > > } Because they have been saved. > instead of this: > if ($condition) > { > file://action 1 > file://action 2 > file://action 3 > } Because they are damned to hell. :-) Bottom line: You'll never, ever, ever get a majority vote on this one. Use the one you like, and deal with it when somebody else uses the other one. -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Hmmm?
You wrote: > additionally I also tend to always provide an alternative, especially if dealing > with nested ifs or loops, even if just a comment... call it habit (from where I > don't know). > > if($condition){ > do this > }else{ > # oops, $condition didn't exist > } > > saves a hell of alot of time when going back through the code 6 months later > trying to remember what was being done where. personal opinion mind you It's a good idea. The only problem is when you come upon a situation where you don't want to do anything "else" at that point. Where you simply want to skip the rest of the if block if the condition isn't true, and continue on with the rest of your script. Then, using an else isn't what you want to do. -- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Hmmm?
Why you ppl. do this: if ($condition) { //action 1 //action 2 //action 3 } instead of this: if ($condition) { //action 1 //action 2 //action 3 } with the '}' you'll see directly the new code block that belongs to the IF statment. anyway...it's just a style after all "Fredrik Arild Takle" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I think it's impossible to read/understand my own scripts if i don't do it. > > Do: > >if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > instead of: > > if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > Best Regards > Fredrik A. Takle > > "Keith Jeffery" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Simply indent formatting for readability. I personally don't indent after > > the > > > > > "Kyle Smith" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Whenever i get a php script off a website why is it that most of the main > > parts in the script have a space from the left border. eg > > > > > echo"spazzz"; > > ?> > > > > > > > > -lk6- > > http://www.StupeedStudios.f2s.com > > Home of the burning lego man! > > > > ICQ: 115852509 > > MSN: [EMAIL PROTECTED] > > AIM: legokiller666 > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Hmmm?
No, no, I indent my code normally, just not after the $fileArray[$i]\n"; } } ?> Not indenting after the wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I think it's impossible to read/understand my own scripts if i don't do it. > > Do: > >if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > instead of: > > if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > Best Regards > Fredrik A. Takle > > "Keith Jeffery" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Simply indent formatting for readability. I personally don't indent after > > the > > > > > "Kyle Smith" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Whenever i get a php script off a website why is it that most of the main > > parts in the script have a space from the left border. eg > > > > > echo"spazzz"; > > ?> > > > > > > > > -lk6- > > http://www.StupeedStudios.f2s.com > > Home of the burning lego man! > > > > ICQ: 115852509 > > MSN: [EMAIL PROTECTED] > > AIM: legokiller666 > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Hmmm?
oh man... it gives me such a headache when i have to try and make sense of scripts with no indentation (or arbitrary indentation)... it's always fun dealing with things like this :-) if ($this){ print " hi ";} else {print " bye "; } > -Original Message- > From: Fredrik Arild Takle [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 01, 2001 12:58 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Hmmm? > > > I think it's impossible to read/understand my own scripts if i don't do it. > > Do: > >if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > instead of: > > if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > Best Regards > Fredrik A. Takle > > "Keith Jeffery" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Simply indent formatting for readability. I personally don't indent after > > the > > > > > "Kyle Smith" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Whenever i get a php script off a website why is it that most of the main > > parts in the script have a space from the left border. eg > > > > > echo"spazzz"; > > ?> > > > > > > > > -lk6- > > http://www.StupeedStudios.f2s.com > > Home of the burning lego man! > > > > ICQ: 115852509 > > MSN: [EMAIL PROTECTED] > > AIM: legokiller666 > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Hmmm?
I think it's impossible to read/understand my own scripts if i don't do it. Do: "; for ($ii = '1'; $ii <= '32' $ii++) { echo $ii." "; } } echo "All done!"; ?> instead of: "; for ($ii = '1'; $ii <= '32' $ii++) { echo $ii." "; } } echo "All done!"; ?> Best Regards Fredrik A. Takle "Keith Jeffery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Simply indent formatting for readability. I personally don't indent after > the > > "Kyle Smith" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Whenever i get a php script off a website why is it that most of the main > parts in the script have a space from the left border. eg > > echo"spazzz"; > ?> > > > > -lk6- > http://www.StupeedStudios.f2s.com > Home of the burning lego man! > > ICQ: 115852509 > MSN: [EMAIL PROTECTED] > AIM: legokiller666 > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Hmmm?
Simply indent formatting for readability. I personally don't indent after the wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Whenever i get a php script off a website why is it that most of the main parts in the script have a space from the left border. eg -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Hmmm?
It's called identing. It's just there to make the script more readable. That's common to almost all programming languages. Some programmers doesn't ident they code anyhow. Basically you increase the ident whenever you enter in a deeper code block. "Kyle Smith" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Whenever i get a php script off a website why is it that most of the main parts in the script have a space from the left border. eg -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]