scriptygoddess

Archive for the ‘PHP’ Category

13 Jan, 2010

Never Update the Copyright Year Again (on a PHP page)

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 [...]

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

Use PHP to get the current page/file name

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

How to use Session Cookies in PHP

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

MySQL Cheatsheet

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 [...]

13 Feb, 2007

Store Locator using PHP and AJAX

Posted by: Jennifer In: PHP| Scripts

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…


Featured Sponsors


  • Michael: You can use get_header(2) in your case. The filename of your custom header has to be header-2.php. The problem with include(your_file.php) is, all
  • cliff: hi wonder if you can help me, pls i designed www.kouga.mobi using dreamweaver CS3 and now want to make the phonenumbers into links so that if you
  • jerey: how do i rewrite this because it tried RewriteEngine on #Options +FollowSymlinks RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FIL

About


Advertisements