13 Jan, 2010
Posted by: Jennifer In: PHP
This is a really silly little trick – but if you have a PHP page that has a © copyright year at the bottom – there is no reason you should be updating that every year (unless it's just something you overlooked initially) As you get requests from clients now that we're in [...]
23 Feb, 2008
Posted by: Jennifer In: PHP
On one of my projects recently, they needed a dynamic bar graph that would show the progress towards a goal of donations. I've never done something like that before, and it turns out it's actually pretty simple to do. I'll explain how the code works and then include everything at the end.
13 Jul, 2007
Posted by: Jennifer In: PHP
I probably already have this posted somewhere, I know I use it a ton but always have to look it up for the exact syntax. Here's how you can get the name of the current file (ie. if your file is "aboutus.php" this will echo "aboutus.php")
<?php
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
echo $parts[count($parts) - 1];
?>
I've [...]
28 May, 2007
Posted by: Jennifer In: PHP
I had written this tutorial sometime ago with the intention of cleaning it up and posting it here. Finally getting around to this. The original purpose of the tutorial was to explain how to use session cookies to a friend of mine who was working on a form that was a number of pages long. [...]
For a long time I resisted the urge to put ads on the site. I'm sure you've noticed I finally caved in this past year. I've tried to keep it relatively unobtrusive. In one case I was contacted directly to put an ad up on one of my category pages in the content area. I [...]
24 Mar, 2007
Posted by: Jennifer In: PHP| mySQL
Another mini-cheatsheet… I know this stuff, but I'm always looking it up for the exact syntax.
Connect to MySQL and to the database – mysql_connect
$connect = mysql_connect("localhost", "mysqluser", "userpassword") or die(mysql_error());
Select the database – mysql_select_db
mysql_select_db("databasename", $connect) or die(mysql_error());
Close connection – mysql_close
mysql_close($connect) or die(mysql_error());
Select data from the database – mysql_query
$myquery = "SELECT tablefield, tablefield2 FROM tablename WHERE [...]
Well, this was fun! I just made a store locator for a client using PHP and AJAX!
I was basically following the instructions from this page: SomeCoders.com (Retrieving database information with AJAX, PHP and MySQL)
Take a look…