Archive

Author Archive

How to create a simple dynamic php/mysql web page

January 16th, 2010 Comments off

I am always creating simple php websites that get data from a mysql db. The first step is to set up the db. You can do this in your control panel. Once you do this make a note of the db info. This will be db name, db password. Next you need to go into mysql and create a table. I normally do this with phpmyadmin. Most web hosts provide this for you.

Next you need to create a config.php file where you store the connection information. You will include this on any pages that access the db later. Most people stick this in a includes sub directory.

#most of the time this is localhost but some hosts like pair.com will assign you a db server name
$db_server ="localhost";
$db_name = "name_of_db";
$username = "user_name";
$password = "password";
$dbh = @mysql_connect($db_server,$username,$password) or die ("Connection failed."); $db = @mysql_select_db($db_name) or die ("Connection made. But database '$db_name' was not found.");
?>

Every page that you want to access the db from put this line of code at the top

Now you need to create a page. There are different types of pages. Some pages will show a list that comes from a db search and others that will show just one record. First lets create a page that creates a list of records from the db. Each one of the items in single quotes can also be a php variable. You can get this from something declared before on the page or you can get it from a var passed from the url. When you pass a variable you access by using $val = $_GET['word']; . If you have the URL http://www.example.com/page.php?myvar=test Then $val will contain “test”.

Create a sql search to get your data. What this does is pull the data from the db.

$query = "SELECT count(*) FROM `table_name` WHERE Row_Name = 'some_text_your_looking_for' ORDER BY Row_Name";
$result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR);
$query_data = mysql_fetch_row($result);
?>

Create a loop to display the data.

while ($row = mysql_fetch_assoc($result)) {
echo $row['Row1_Name'];
echo "
";
echo $row['Row2_Name'];

#you can also create links
echo 'Anchor Text';
}
?>

Next you can create a page that returns the data from a specific record. If you create a link like above you can create a page that uses the variable set in the url.

$query = "SELECT * FROM Table_Name WHERE Row_Name = 'search_text' ";
$result=mysql_query($query);
$row=mysql_fetch_assoc($result);
echo $row['Row1_Name'];
echo $row['Row2_Name'];
?>

This is a very simple tutorial you may need a lot more depending on your needs. Sometimes you might have to search the db for data that does not exactly match. When this happens you can use the wildcard %.

SELECT * FROM Table_Name WHERE DISTNAME LIKE '%ISD'

What this does is return all the rows that end in ISD. You can also use AND and OR like if you want to pull city and state. You would have to do that because a city name is not unique to a state there would be several rows with the same city but with different states.

Categories: Google Tags:

Show different content for PPC users with PHP

December 28th, 2009 Comments off

I just recently created a new site for a client and he decided he wanted to do PPC. I created a landing page for him. I still wanted the users to be able to see the rest of the site but I wanted to show a specific phone number to PPC visitors. I created some PHP code that gives a 10 year cookie to anybody who hits my PPC landing page. On every other page in my site I put in some code that checks for that cookie and gives then a PPC phone number if they find that cookie.

Code for PPC landing page. Must be very first thing on page.

setcookie("ppc", "this works", time()+60*60*24*365*10);
?>

Code for every other page.

if (isset($_COOKIE["ppc"]))
echo 'ppc info';
else
echo 'non ppc info';
?>

You can use that code to display a different logo or image with phone number in it or special text. If you have your phone number all over the place I would put your phone numbers in different include files so that you can change them easily.

Code for include

if (isset($_COOKIE["ppc"]))
include 'ppc-phone.inc';
else
include 'phone.inc';
?>

Technorati Tags: , , ,
Categories: Adwords, web design Tags:

Top ten CSS articles

August 6th, 2009 1 comment
Categories: web design Tags:

On Page SEO for eCommerce Websites

July 10th, 2009 10 comments

Putting up an ecommerce website with the descriptions from the manufacture is bad for SEO. Putting up any content on your website that is not unique is not good for SEO. The excuse that “everybody does it” is not valid. Sure there are some people out there that rank well using manufacture descriptions but your not them. When you get the same kinds of links that they do you will outrank them because you have unique content. When Google spiders the web they notice that there are a lot of people selling the same item with the same description. If you want Google to notice you you’re going to have to be different. A very good example of a website doing this right is www.jpeterman.com.

If your serious about getting more sales through organic search traffic your going to have to spend the time or hire somebody to do it for you. Somebody is going to have to go in and rewrite your descriptions. When you rewrite the description you need to make sure you include keywords you want to rank for. Also add alt tags to your images. Another thing I recommend is to consider how Wikipedia is set up. In your description talk about other items that go with this item and link to them with anchor text. Notice in Wikipedia articles there are lots of links to other pages in Wikipedia. That is one of the reasons they rank so well. Internal linking can help you rank above your competitors. On page SEO is hard work and has to be done on large ecommerce websites.

Don’t forget that an ecommerce website is also a website. It should not just be a cart. You need to include articles. The more interesting your site is the more links you will get. Talk about your products. Talk about how they can be used in different ways. Talk about ways to augment them. Write stories about somebody using your product. Spend time on your template and try to keep the code down so that Google mostly finds text instead of tons of junk. Don’t forget that people will leave your website if your page is not loading very fast.

Austin PPC Company

Categories: Google, SEO Tags:

Just got a Vanity URL from a new account

June 30th, 2009 Comments off

When Facebook launched new vanity URL’s I created a new account for www.seofox.com because I wanted an account that was not personal. They would not let me get a vanity url that night. Well I logged in today and got my Vanity url. www.facebook.com/seofox

Technorati Tags: ,
Categories: Google Tags:

Make Twitter Search Work for You

June 16th, 2009 1 comment

Twitter offers a real time search of all users. It is a very powerful tool for marketing. It is a way to get information and a way to give information.

Online Reputation – Twitter search allows you to monitor good and bad things said about you. You should have a Twitter search rss feed set up for your company name and products as well as employee names. This gives you extra time to take advantage of that information. If it is bad information you can start tweeting a response. I would use a separate account to communicate with people that said bad things. Don’t point out bad things on your company account. If the information is a link to something bad you can start working on content to make sure the bad information does not show up first page in other search engines. It is important to know what the top ten results for your brands are and make sure it is all positive. Make sure it is hard for some negative blog post to pop out of nowhere and rank number 3 for your brand. If it is good information use your main account to re-tweet this person and follow them. It is always good to encourage your fans.

Promotion – The obvious way to promote your company and products is to make useful tweets to your followers and by sending tweets @ people. The other way is to take advantage of the real time twitter search. Make some tweets that are not toward your followers. Promote your service and use keywords that people might be searching for. If you are doing SEO and/or PPC you should have a wealth of information on what keywords are being searched for and convert. Don’t do this too often since it might alienate your followers. It is important to keep your followers. You can also use your analytics to find out what time of day is best for certain terms. Also you can work in your terms into your tweets to your followers. Twitter search works like Google in that the words do not have to be together. Lets say you want to show up for the search “buy blue widgets” all you have to do is make sure those 3 words are in your tweet anywhere and in any order and you will show up for that search.

Categories: Google Tags:

Gmail Search Operators

June 4th, 2009 4 comments

I follow @GoogleAtWork on twitter and they twittered This link that shows how to use search operators in Gmail. I was shocked. This has changed my world. This link to see them all. I’m going to talk about a few that I’m going to start using.

“from:elliot filename:pdf” shows all messages from Elliot that have a pdf attachment

“from:eliot has:attachment” shows all messages from Elliot that have any attachment

“from:eliot in:anywhere” Shows all messages from Elliot that are in any folder trash, spam, sent…

I really like the in: feature normally I have to switch to that mailbox then do a search this way I can do all my searches from my inbox. (in:trash, in:spam)

Is:unread This shows me all my unread email

after:2004/04/16 before:2004/04/18 Messages sent between April 16, 2004 and April 18, 2004.*

If you start using labels more and/or you use Gmail to check several email address like I do the label operator is invaluable.

Technorati Tags: , ,
Categories: Google Tags:

Setting up Ad Groups in Yahoo is different than Google

June 3rd, 2009 1 comment

Many people that work in the PPC world just outright avoid Yahoo Search Marketing because it is just harder to use and you have less control. This is very true. Yahoo is working on making it better in some ways like they are making a offline editor like Google Editor. What I wanted to do was to describe how to use Yahoo PPC so that it can make you money. Yahoo is number 2 when it comes to number of searchers and can make you some money. Yahoo will bring less traffic than Google but it will bring you sells. I have even seen in some cases where yahoo had a better cost per conversion (CPA). Yahoo has a few good thing that Google does not.

Read more…

Categories: yahoo Tags:

Keyword Rich URL’s are not necessary – Don’t Change!

June 1st, 2009 16 comments

I wish people would not read some old blog post or forum thread about URL’s and change all their page names. Do not ever change your page names. There is no reason whatsoever to do it. Even if you switch from asp to php or some other server side language you can keep your old url’s with a very easy tweak to your system regardless of what web server you use.

There is no benefit to switching to keyword rich url’s. As a matter of fact 100% of the time there will be a negative effect in the short run.

Categories: Google, SEO Tags:

Do you have a 404 strategy?

May 17th, 2009 10 comments

Do you have a 404 strategy? Do you know what a 404 is? First off lets describe what a 404 is just in case you don’t know. When somebody comes to your website using a URL that does not exist by default your server will just send the user a 404 error which shows your visitor a white page with huge letters that say “NOT FOUND”. Most the time the person just hits the back button and moves on. The answer to the other question should be obvious.

I’m not going to get into the technical side of how to create a 404 page there are lots of blog posts and articles already out there. I’m going to talk about your strategy. What is your goal? Do you want to entertain, solve the problem, or act like nothing happened?

Here is a list of strategies that people use and the pros and cons of each.

1. Redirect all 404 traffic to the front page. This only slightly better than doing nothing. This confuses some people. They clicked on a specific link and they end up at your front page that may have nothing to do with what they clicked on.
2. Create a template page of your website and put a page not found message on that. With this method at least now they know that something went wrong but still does not help the person. They still can’t find what they are looking for.
3. Create a custom 404 page with some logic that tries to guess what the person is looking for. I would also put a search box on this page as well. If part of the URL is correct like the folder you can have a specific 404 landing page with a list of things they might be looking for. Try to help the visitor find what they need.
4. Create some gimmick like a funny video, cartoon, or game. This can get you some attention and might get you some viral attention. Here are some examples.

Another benefit to using a custom 404 page is that you can put your analytics code on it. If you don’t have a custom 404 page it will not show up in Google Analytics. You need to modify the tracking code on your 404 page so don’t just use the normal footer. Here is a link to how to modify that code. It is very important to monitor your 404 errors. You can find where people have linked to you incorrectly. You can send them a message to fix it or 301 redirect it to the correct page.

Categories: Google, web design, Website Marketing Tags:

I’m a little tired of everybody having a premium section

May 13th, 2009 4 comments

I was just over at www.searchengineland.com and 2 pages into reading article titles they tell me I got to pay to read more. On twitter I saw that www.jensense.com has a “Pro” section. www.seobook.com, www.seomoz.com, www.webmasterworld.com, www.shoemoney.com and I’m sure there are others all have premium sections. I miss the old days when everybody talked online and you did not have to pay them extra. These people are all now very rich because they gave great advice online. Now that they are all famous they want to make an extra buck. They get lots of business from giving away information in the past and now they just rest on that fame and charge for their information. They don’t have to prove that they are smart any more so they want to charge us for it.
Another thing that has happened is that the forums suck now that everybody has their own website. You used to be able to go to one or two forums and talk with everybody now you have to go visit 20 websites to talk to the same people. At least everybody is getting on twitter but you don’t get discussions like you did on the forums.

Categories: blogging Tags: , ,