10 Tips That Every PHP Newbie Should Know
September 18, 07 by ReniXThanks for visiting! If you're new here, you may want to subscribe to my Rss Feed. This blog posts regular Internet news, updates for apps, security, ideas, hacks, quick fixes and everything about hi-tech. Go ahead, subscribe to our feed!

I wish I had known these 10 tips the day I started working with PHP. Instead of learning them through painstaking process, I could have been on my way to becoming a PHP programmer even sooner! This article is presented in two parts and is intended for folks who are new to PHP.
Tip 1: MySQL Connection Class
The majority of web applications I’ve worked with over the past year have used some variation of this connection class:
[sourcecode language='sql']
class DB {
function DB() {
$this->host = “localhost”; // your host
$this->db = “myDatabase”; // your database
$this->user = “root”; // your username
$this->pass = “mysql”; // your password
$this->link = mysql_connect($this->host, $this->user,
$this->pass);
mysql_select_db($this->db);
}
}
// calls it to action
$db = new $DB;[/sourcecode]
Simply edit the variables and include this in your files. This doesn’t require any knowledge or special understanding to use. Once you’ve added it to your repertoire, you won’t likely need to create a new connection class any time soon. Now you can get to work and quickly connect to your database without a lot of extra markup:
[sourcecode language='sql']
$result = mysql_query(”SELECT * FROM table ORDER BY id ASC LIMIT 0,10″);[/sourcecode]
Read the rest of this entry »

Glad to see you here and Thank You for your visit. My name is Lirent, born in February 1983 in a small city in Europe. This is my blog about Hacks, Tips and Free Resourse for the WordWideWeb.





