Results 51 to 73 of 73
-
07-02-2006, 05:23 PM #51New Member
- Join Date
- Apr 2005
- Posts
- 4
I guess it's a matter of preference, but I think that if you work with scripts that include a douzen pages and thousands of lines it's easy to loose track of what variable does what, and with clear naming and stating the type of variable that becomes more clear. For me the capitalized first letters make it easy to read the variables on a page when scanning trough a script that needs to be altered.
Also the heredoc can indeed be used for that purpose, again it's a matter of preference.0
-
08-28-2006, 09:06 AM #52Junior Guru
- Join Date
- Jan 2005
- Location
- Leeds, England
- Posts
- 187
i use dreamweaver to code my PHP. it has colour highlighting automatic indentation. and has a built in ftp. i always upload my entire site to a test folder before showing it publicly.
0
-
08-28-2006, 08:29 PM #53Newbie
- Join Date
- Aug 2006
- Posts
- 6
Very Helpful, Thanks
0
-
09-16-2006, 03:08 PM #54Newbie
- Join Date
- Sep 2006
- Posts
- 12
thanks for the sweet post, because of this ive realised loads of mistakes in my programming and have sorted them out!! thanks once again
0
-
10-13-2006, 11:21 PM #55Junior Guru
- Join Date
- Jan 2006
- Posts
- 230
very helpful. Thank you all for all the good tips.
One thing I would like to know though..... with sessionstart, how can I have it where it is not in the first thing in the page, I would like to include it in a header but always got errors. any ideas would be greatWeb Hosting Review - Real Reviews by Real People Submit your company and get a link to your site, Read Reviews GET YOUR Voice HEARD and REVIEW your HOST NOW!!! Check out our IT Blog Tips & Tricks0
-
10-24-2006, 08:01 PM #56Web Hosting Master
- Join Date
- Feb 2006
- Location
- Buffalo, NY
- Posts
- 1,501
I think you should mention use of variables, don't declare them unless you're going to use it a few times throughout your script.
Also protecting yourself from SQL injections, when / should you cache your work, memcached, etc..
I recommend new coders read these Zend tutorial(s) (There are three parts) for a good primer.
Aside from that nice little writeup, easy to read and informative.
Also I would usually use the following for a include.
PHP Code:<?php
include_once('config.php') or die('Error!');
?>
Keep in mind the difference between include(), include_once(), require_once(), etc.█ Cody R.
█ Hawk Host Inc. Proudly Serving websites since 2004.
█ Official Let's Encrypt Sponsor0
-
05-19-2008, 11:46 AM #57Newbie
- Join Date
- Nov 2007
- Location
- England
- Posts
- 13
Very nice, Especially for PHP learners
0
-
05-23-2008, 02:24 PM #58Temporarily Suspended
- Join Date
- Feb 2007
- Posts
- 185
Make sure you optimize your database structure and use indexes. Cache data in memory as much as possible, however this would only be useful if you're website is very inversive with queries. If it is an average site then use a opt cacher, such as XCache. Preform a crap load of benchmarks to help you eliminate most of the bottlenecks. Google can find you a lot of good tips.
0
-
05-24-2008, 05:38 PM #59Newbie
- Join Date
- Dec 2007
- Posts
- 12
Combining lines is not necessarily a good idea. Some people get annoyed reading scripts containing combined lines.
0
-
05-30-2008, 10:45 AM #60Newbie
- Join Date
- Feb 2008
- Posts
- 7
Programming is all about making your own style. Some people use all the PHP rules others just put something together and don't care. Still nice tutorial for people that just began programming PHP
0
-
06-15-2008, 04:16 PM #61Newbie
- Join Date
- Jun 2008
- Posts
- 14
I agree, however everyone has their own style of programming.
0
-
10-11-2009, 11:16 PM #62New Member
- Join Date
- Oct 2009
- Posts
- 1
Very nice post, i like how good people are really dedicated to their craft.
0
-
11-28-2009, 08:22 AM #63Newbie
- Join Date
- Nov 2009
- Posts
- 21
Nice stuff.It's for beginners.
After working hours and hours with programming and php your biggest problem will be some stupid mistake you made And you will spend next whole day trying to find out what's wrong, then you will give up.Next day in the morning while you are drinking coffee - bang, you nailed the error.The problem was YOU.It's always your mistake0
-
03-29-2010, 07:44 PM #64Junior Guru Wannabe
- Join Date
- Mar 2010
- Posts
- 89
Thanks man this tutorial was a little over my head, do you know of any more basic tutorials out there I can start with?
0
-
03-29-2010, 08:25 PM #65Web Hosting Evangelist
- Join Date
- Sep 2004
- Location
- Cluj-Napoca, Romania
- Posts
- 504
Move to Python and Django! Sorry, just joking .
I think the best advice is to use a PHP Framework, like Zend.0
-
07-01-2010, 03:22 PM #66Newbie
- Join Date
- Feb 2008
- Posts
- 10
Frameworks do help a lot. They have power and flexibility. As well as giving you the ability to replicate things fairly easily for additional sites. Zend is a good one.
0
-
08-03-2010, 03:38 PM #67Disabled
- Join Date
- Aug 2010
- Location
- Somerset, UK
- Posts
- 62
I would add that a lot of people I know tend to use line breaks to seperate blocks of code and have all elements within the block all on the same line. I guess thats a matter of preference though. Myself I like both depending on the type of script and what makes it easier and faster to edit / update.
Another way you can do this is:
PHP Code:<?php
mysql_query("INSERT INTO `tableName` SET `id` = '1', `name` = 'Mike'") or die(mysql_error());
?>
I have to say this is a great way to do it!
Thanks for sharing, very good yet brief overview!0
-
12-07-2010, 09:32 PM #68Junior Guru Wannabe
- Join Date
- Nov 2010
- Location
- USA
- Posts
- 51
wow this was very informative, and bookmarked it for future reference. Nice work on the tutorial man.
0
-
12-12-2010, 12:44 PM #69Newbie
- Join Date
- Dec 2010
- Posts
- 11
Another great tip: always use PDO instead of mysql API, it is much easier to code and safer.
0
-
12-12-2010, 12:47 PM #70Newbie
- Join Date
- Dec 2010
- Posts
- 11
Use HTML Purifier if you want to filter out any XSS, code injection, fixed improper HTML syntax or malicious code. It's so simple to filter out all bad codes with just a line of PHP code.
0
-
12-12-2010, 12:51 PM #71Newbie
- Join Date
- Dec 2010
- Posts
- 11
To save time benchmarking,
http: / / net-beta.net / ubench0
-
12-17-2010, 12:42 AM #72WHT Addict
- Join Date
- Dec 2010
- Posts
- 103
Great simple tips that can save you hours of debugging because theres less chance of you missing a microscopic flaw because your code is neat.
0
-
12-18-2010, 09:22 AM #73Newbie
- Join Date
- Nov 2010
- Location
- UK
- Posts
- 12
Including files in your scripts. Apparently using single quotes and include is faster:
include 'my_file.php';0