5 Tips For Learning PHP Quickly

January 9th, 2011



I have compiled my five tips for learning PHP quickly for beginners. It is sometimes difficult to get started when learning a new programming language and I hope these tips help you. These tips will help you stay organized, learn quickly, and help get over any hurdles you may encounter.

Let’s get started.

Tip 1) Start fresh. I try to start every project with a fresh clean page. If you try to take code from someone else and convert it to yours syntax can get missed or worse they may not have done it right either. As you get going you can make a template of all the things you might put in a project like title and other things but starting out I like to start fresh. This also helps work the basic set up into every project.

Tip 2) Use error reporting. All PHP has a snippet of code that will allow you to see any errors that may come up.


What is Keyword Targeting?

January 8th, 2011



A lot of people will talk about keyword targeting, but aren’t 100% sure what it’s all about. Some people have a general idea about it, but don’t go about it the right way. You want top listing on the search engines, and you need to target keywords, so you get a #1 listing. If you sell green crystal watches, most people will target “Green crystal watches”, which this is highly targeted, if the search term is only getting 10 searches a month, you might only get 1-2 visitors from it, which means you’re not going to any noticeable about of sales or conversions from it.

The best thing to do, is to get a keyword search tool, there is a nice one called “good keywords” which is free, also you can use Google AdWords research tool, or msn adcenter research tool, I find these better as they are up to date and are great at making suggestions. What you want to do is try and find a set of keywords that are related to your products, but get a good amount of monthly searches, once you have come up with a list, you want to start targeting the phases you have (a phase is a keyword that is two words or more). It is usually best if you use multiple sources for your keyword research, as you can get a broader picture, which will be more beneficial in the long run, as you’ll then be targeting the general market, and not just the visitors to one search engine.

The more targeted your keyword is the better, but also you want the keywords to have a high amount of search made for it every month, striking a balance if often an art in itself, but with a little practice you can get it to a level that you are able to work with (ie amount of work in relation to how many visitors you get from it).

Writing articles is a great way to target keywords you are trying to rank for, writing articles about your keywords, and publishing them on your site, and then building backlinks is one of the most efficient ways to raise your rankings to the first page. Another way is to buy links on websites with a similar content / products and getting them to link directly to your product / content pages for that keywords with the keyword in the link text. Another way to get links with Articles is to publish them to article directories with your keywords in the bio box linking back to your website.

Keyword marketing is more important than most people realize, as if you chose the wrong keywords, and work on building them, they could be dead weight as they get no searches, the opposite is also true, if you choose an extremely highly completive keyword (just say watches) then you’ll need to do an excessive amount of work to get to the front page, which might not be viable for your company in regards to much you’ll need to spend to get the rankings.

The Easiest Way to Add a Date From PHP to MySQL

January 1st, 2011



Often you will be required to store a date in MySQL. Either upon an update of an existing record, or on a fresh insert of a new record. Good programmers are particular about the type and quality of data that is stored in a MySQL database. Sometime you do not want the date to be created by MySQL at the time of the insert or update. Rather, you want the date to be created in PHP during code execution. Although the time difference from the date creation could be well under a few milliseconds, there is a difference. This difference could add up if several transactional sequences must happen.

A simple alternative is to create the date in PHP and then transfer that information to the query that will by run by your database server.

Below you will find a quick method to generate the date value for the two types of MySQL field types: date, and datetime.

Step 1. Create a field in your database that is either date or datetime.
If the field is of type date, it will have this format: [Year-Month-Day]. If the field is of type datetime, it will have this format: [Year-Month-Day Hour:Minute:Second]
Step 2. After you have created the SQL to be used in the MySQL Query, populate the date field with either the variable $now or $today. Doing so, will match the insert or update date/time field in PHP, to that used in your MySQL database.

PHP Image Uploader Program Code

December 10th, 2010

This PHP Program is useful when you want to upload images only.

$numoffiles = 5;
echo '

‘ ;
for ($i = 1; $i<=$numoffiles; $i++)
{
echo 'Image'.$i.':
‘;
}
echo ‘
‘;
echo ‘

‘;

if(isset($_POST['action']))
{
$uploaddir = ‘C:/PHP/uploadtemp/’;
for ($i =0; $i<$numoffiles; $i++)
{
$filename = $_FILES['file']['name'][$i];
$filetmp = $_FILES['file']['tmp_name'][$i];
$filesize = $_FILES['file']['size'][$i];
$filetype = $_FILES['file']['type'][$i];
$ext = substr(strrchr($filename, "."),1);
$conf = $uploaddir . $filename;
$filepath = $uploaddir . $filename;

if ($filename != "")
{

if (!file_exists($filepath))
{
if ($ext == "jpg" || $ext == "gif" || $ext == "tiff" || $ext == "png" || $ext == "bmp")
{
if($filesize < "500000")
{
$upload = move_uploaded_file($filetmp, $filepath);
echo '‘. $filename . ‘ was successfully uploaded…
‘;
}
else
{
echo ‘‘.$filename . ‘ greater than the maximum file size allowed…
‘;
}
}
else
{
echo ‘‘. $filename . ‘ is invalid file type…
‘;
}
}
else
{
echo $filename . ‘ already exists…
‘;
}
}

}
}

?>

Should You Concentrate on PHP as a Freelance Programmer?

November 18th, 2010

Getting into the business of being a freelance programmer can be exciting, but also confusing for those who have a too broad scope of languages and skills. Sure, it can be useful to know a lot of things, but it can turn into a detriment when you’re trying to focus on one particular aspect of your skillset that you’re truly good at. PHP can make a great answer to your questions and offer you a great way to invest your time and skills – but it’s not the most suitable choice for everyone.

The most important thing to consider when thinking whether to market yourself as a freelance programmer towards people who need PHP is the matter of security. With security being such a top priority in today’s websites and Internet-related applications in general, you really have no excuse for letting your solutions slip in that regard in any way. If your websites fail to meet the basic expectations for a secure service, your clients are going to dwindle and eventually all go away.

Also, how good is your design? If you can offer a complete scripting + design package to your clients, it can instantly make your offer a much more attractive one. With that in mind, it should be noted that HTML and CSS aren’t that difficult to learn, so if you’re not that good in that area (or even can’t do anything at all), you should take some time to familiarize yourself with at least the basic concepts.

Single Quotes and Double Quotes Rage On

November 10th, 2010

Don’t you know whenever you place ‘double quotes you are asking for PHP to look after the content of a variable? PHP will still waste valuable computing time scanning lines even if the following lines do not contain variables inside the double quotes.

Such three lines of codes can be done even speedy if “single” quotes were used in place of “double” ones.

In the present, that may not seem like much, but making PHP check for variables where it doesn’t need to over the course of a larger script, can certainly impede run-time. Just to clarify my point, PHP will not read a variable if it is within ‘single’ quotes.

To keep your scripts fast in your server, avoid double quotes at all costs. Even if you’re working with variables yet you’re thinking of using double scripts.

The Most Recommended Web Programming Today

October 10th, 2010

One of the simplest tools for web applications is the ASP.Net with C# or VB.Net. The C# is the future language for the web which speeds up the development cycle, and other suggested languages for the web. Also, JavaScript syntax would not be too difficult to pickup C#. Likewise, if it is with VBScript, then VB.Net. won’t be difficult to learn.  However, it is a known fact that higher demand goes to the C# developers than those in the VB.NET. The longetivity, validation of technology, the development cycle time and the compatibility concerns should be considered in choosing a platform.

Learning HTML the Easy Way

September 10th, 2010

Learning HTML or Hypertext Markup Language does not require any professional IT experience. This computer application is as simple and easy as it may seem to be. Performing Hypertext in the Word document is as simple as linking a keyword to direct a reader into a specific link. These said links can either be found on the same or other pages with the link that carry on a much broader explanation and variety of other web links of the same topic. This basic HTML Tutorial would best describe common HTML tags needed in learning the fundamentals as well as advance HTML.

Sending Emails in PHP Example

August 10th, 2010

With the help of smartwebby.com, we are able to show you the basic example when sending an email in PHP.

Syntax: mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

Ex:

Sample PHP Code:

<?php

//Check whether the submission is made
if(isset($hidSubmit)){

//Declarate the necessary variables
$mail_to=$txtEmailto;
$mail_from=$txtEmailfrm;
$mail_sub=$txtSub;
$mail_mesg=$txtMsg;

//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,”From:$mail_from/r/nReply-to:$mail_from”))
echo “<span class=’red’>E-mail has been sent successfully from $mail_sub to $mail_to</span>”;
else
echo “<span class=’red’>Failed to send the E-mail from $mail_sub to $mail_to</span>”;
}
?>

Sending Emails in PHP

July 10th, 2010

During the 80′s, people still communicate through snail mails until electronic mails came in. Most professionals in today’s time spend 50% of their working time using e-mail and its use is no doubt increasing due to globalization.

Sending emails procedure varies. One of them is sending in PHP. Mails in PHP are easily sent with the help of library function ‘mail‘.

This function takes four parameters to send E-mails from a PHP page and returns ‘true‘ upon successful delivery of Email. The parameters of this function are as follows:

  • Recipient
  • Subject
  • Message
  • Headers (Sender E-mail address)