Tag Archives: PHP

PHP Code Get Most Recent Wordpress Post

PHP Code Get Most Recent Wordpress Post
This is a quick example using only vanilla PHP.  There are more dynamic ways to do this using RSS classes built into PHP addons, which I won’t go into detail here.  Instead, we will just use vanilla PHP, and parse the XML by hand.

On to the code, I take [...]

Don’t Write Code In The Dark

Don’t Write Code In The Dark…
I may be showing my age a little bit here but I remember watching Are You Afraid Of The Dark? on Nick as a kid.  It was quite a cheezy show, but hey what do you expect.
Do you know what happens to people during sensory deprivation? (A brief introduction [...]

How To Get The Last MySQL Auto-ID in PHP

There will be times when you will need to retrieve the last auto id on a table where you just did an insert. They way to do this is as follows:
<?php

$link = mysql_connect(‘host’, ‘user’, ‘pass’);
if(!$link)
{
die(‘could not connect: ‘. mysql_error() ) ;
}
mysql_query(“INSERT INTO table (field) values (‘val1′)” );
echo “Last ID is “.mysql_insert_id());
Be sure you do [...]