scriptygoddess

Archive for the ‘PHP’ Category

On a project I was working on recently, I was pulling in some css for iPhone users using PHP with the following code: <php if (strpos($_SERVER['HTTP_USER_AGENT'],"iPhone")) { ?> … CUSTOM CSS FOR IPHONE… <php } ?> This will also work for iPhones and iPod Touch: <php if (strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod')) { ?> … CUSTOM CSS… […]

Comments Off on CSS for iPhone's eyes only (watch out for the cache)

01 Apr, 2010

Showing multiple random quotes

Posted by: Jennifer In: PHP|Script snippet

Showing random quotes isn't anything new. When I needed to do something similar on a site recently, there were plenty of pre-written scripts to choose from. The trick however, was that I wanted to show more than one quote at a time (and of course I didn't want to show the same quote twice. That […]

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 a new […]

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

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: mySQL|PHP

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

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

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements