Managing External Links
Website Automation with PHP and MySQL, Part 9
Low End Mac Reader Specials
Memory To Go Special: MacPro 8 Core Memory 4GB kit $154 / 2GB kit $94, New 2008 iMac 2GB $46. MacBook Pro / MacMini / iMac Intel Core2 DUO 2GB $44 / 1GB $23--Free shipping available.
Download Typestyler, still the Ultimate Styling Tool for Internet, Print and Video Graphics. Works great in Classic with a Native OS X Version on the way. Free Tryout: www.typestyler.com
LA Computer Company: Specials on AppleCare, iMac's, Apple Batteries and Apple A/C Adapters. Also Great prices on Used Apple Computers. Call 1-800-941-7654 Click Here.
OWC: Juice up your iPod w/NewerTech High Capacity Battery from $19.99 Free Installation Videos for most models. Pro Installation Service w/FedEx Shipping From $57.95 (Battery Included). - www.MacSales.com
Mac users can finally play Party Poker for Mac. Not only that, they can also learn how to play PokerStars for Mac.
Laptop Hardware Provided by TechRestore - Overnight Mac & iPod Repairs.
Compare products like desktop computers, laptops, and LCD TVs side by side! All the information and reviews to make the best purchasing decision for a new cell phone GPS products or MP3 players. The Ciao network makes searching products easy for you.
MacPro Memory 667Mhz With Apple Spec Heat Sink 2GB $90 / 4GB $134 / 8GB $264. Click to Maximize your Macs...
Dan Knight - 2002.06.24
I've been thinking long and hard about automating different parts of the site and making the manual three-times-a-day updates a thing of the past. The last three pieces are handling new articles online, tracking new content, and working with links to content on external sites.
Last week I decided it was time to sit down and create a MySQL database for those outside links. Once the system is in place, new links will be available on the Low End Mac home page as well as the iMac Channel, iBook & PowerBook Page, Power Macintosh page, and WebTV index immediately. We'll still be manually adding content to some other pages, but our frontline link pages can have fresh outside links several times during the day.
Crucial Fields
There's a lot involved here, starting with the fields needed to create and track these articles:
- Category
- Linked text
- URL
- Author, when known
- Column name, not always present
- Website
- Date of publication
- Description
I didn't have to break things down that thoroughly, but this will eventually let me search the database by author, website, or column name to see if some sites or writers tend to receive more clicks - but that's a topic for a future column.
After wading through two months of link archives, we came up with about 20 categories ranging from News and Opinion to AAPL and Oops. We also came up with fairly extensive names of authors and websites. These lists are something we'll deal with later.
I also needed one more category, Flag, to display a U.S., Canadian, U.K., or Australian flag when an article has a specific national focus. That's eight fields.
Helpful Fields
Because publication date isn't always the same as the date we add a link - sometimes we link to a week old article, and other times the article has a publication date several days in the future - we added a Unix timestamp field. With an ID field to number our database entries, that brings us to 10 fields.
We've been adding articles to the database for a few days and went live on Saturday. Sometime today we'll remove the last few manually added links from the home page, and you'll probably never even notice the change, except that new links in the "Around the Web" section are being added more frequently.
Implementation
The only glitch we ran into when creating the MySQL database comes from the fact that MySQL timestamps are not the same as Unix timestamps. In fact, they're not even close. A MySQL timestamp for today would begin 20020624..., while a Unix timestamp is the number of seconds since 1970.01.01.
We have future plans that make the MySQL timestamp problematic, so we changed that field to an integer. More on that when we're ready to make some changes to our display system.
Follow Up
A month ago I promised to look at the PHP code that displays our deal of the day. Sorry it took so long, but here it is:
- $dod = date(Ymd);
- $query = mysql_fetch_array(mysql_query("select * from deals where date = '$dod'"));
- echo "<li>Deal of the Day: <a href=\"$query[URL]\">$query[text]</a>$query[extra]</li>";
As always, a million thanks to my son Brian <http://brkn.net/> for his help with the PHP and MySQL.
And next time we'll look at some of the coding necessary to display data when some fields may be empty.
Recent Online Tech Journal Columns
- Apple's AAUI ethernet connector, 09.04. From 1991 through 1995, Apple used a proprietary ethernet connection. Why they created AAUI and where to find adapters.
- PowerPC G5: Apple's last fling with PowerPC architecture, 05.24. Teaming up with IBM, Apple adopted the PowerPC G5 in 2003 - and phased out the last G5 Power Mac three years later.
- The PowerPC G4: From 350 MHz to 2.0 GHz, 05.24. AltiVec and dual processor support made the G4 a big improvement over the earlier G3 processor.
- The PowerPC G3 story: From 233 MHz to 1.1 GHz, 05.24. The history of the PowerPC 750 family and its use in Apple computers from 1997 through 2004.
- More in the Online Tech Journal index.
Links for the Day
- Mac of the Day: PowerBook 190cs, Aug. 1995 - The last 680x0-based PowerBook could take a PowerPC upgrade.
- List of the Day: Apple TV List The Apple TV List is a forum to discuss the Apple TV.
- August 28 in LEM history: 95: PowerBook Duo 2300 - 00: Gaming on older Power Macs - 01: AppleShare on Linux - From Beebs and Acorns to Macs - 02: Sleep of Death, - Think smarter? - It's the software, stupid - 06: PowerBook 5300 reminiscence - You might be a Mac fanatic if... - Hiding complexity behind elegant simplicity
Recent Content on Low End Mac
- 10 Mac Browsers Compared, Simon Royal, Mac Spectrum, 08.28. A look at Internet Explorer, Radon, Opera, Safari, Shiira, iCab, Firefox, Netscape Navigator, Flock, and Camino running in Leopard.
- Clone and Boot: Another Advantage of the Mac OS, Kev Kitchens, Kitchens Sync, 08.28. Unlike Windows, Apple makes it possible to clone a bootable drive (Classic Mac OS or OS X) and use it with another supported Mac.
- Best MacBook Deals, Low End Mac Deals, 08.28. Used 1.83 GHz, $799; 2.0 black, $875; refurb 2.1 GHz, $899; 2.4, $1,099; black, $1,299; new 2.1, $1,019 after rebate; 22, $1,094; 2.4, $1,219 a/r; black, $1,394 a/r.
- Best iMac G5 Deals, Low End Mac Deals, 08.28. Used 17" 1.6 GHz Combo, $499; 1.8 SuperDrive, $530; 2.0, $600; 1.9 iSight, $625; 20" 1.8 GHz, $580; 2.0, $650; 2.1 iSight, $700.
- Best classic Mac OS Deals, Low End Mac Deals, 08.28. System 6, $10; 7.1, $12; 7.5.1, $4; Mac OS 7.6, $13; 8.0, $13; 8.1, $48; 8.5, $25; 8.6, $20; 9.0, $20; 9.2.2, $20; more.
- CrossOver Strikes Out, Frank Fox, Stop the Noiz, 08.27. Running Windows apps on a Mac without paying for Windows is great in theory, but actually getting Windows software working is another story.
- MacDrought: 4 Months with No New Macs, Dan Knight, Mac Musings, 08.27. The most recent Mac update was over four months ago, and the Mac mini has been unchanged for over a year.
- Resurrecting a Dead Pismo, Spotlight Search Tip, and EasyFind a Good File Finder, Charles W. Moore, Miscellaneous Ramblings, 08.27. Lots of tips on bringing a comatose Pismo back to life, a Spotlight file name search tip, and EasyFind as an alternative to Spotlight.
- Best Intel iMac Deals, Low End Mac Deals, 08.27. Used 17" 1.83 GHz, $625; 20", $599; 2.16, $749; 24", $950; refurb 20" 2.4, $999; 2.66, $1,299; 24" 2.4, $1,299; 2.8, $1,549; new 3.06, $2,094 after rebate; more.
- Best 15" PowerBook G4 Deals, Low End Mac Deals, 08.27. Used 1.25 GHz Combo, $600; SuperDrive, $650; 1.33 Combo, $640; 1.5, $680; SD, $725; 1.67, $730; hi-res, $800.
- Best Time Capsule and AirPort Deals, Low End Mac Deals, 08.27. 500 GB Time Capsule, $294; 1 TB, $468; AirPort Extreme Card, $39; 802.11n Base Station, $166; 802.11g AirPort Express, $60; 802.11n, $98.
- Does Running OS X System Maintenance Routines Really Do Any Good?, Charles W. Moore, Miscellaneous Ramblings, 08.26. Mac OS X is designed to run certain maintenance routines daily, weekly, and monthly - but can't if your Mac is off or asleep.
- Purposeful Reincarnation for Old Macs, Phil Herlihy, The Usefulness Equation, 08.26. The key is to avoid spending more on upgrades than the final use of the machine can justify.
- Best Power Mac G5 Deals, Low End Mac Deals, 08.26. Used 1.6 GHz single SuperDrive, C$499; 1.8, $569; dual, $675, 2.0, $800; 2.3, C$899; 2.5, C$1,199; 2.7, $1,225; 2.5 Quad, $1,500.
- Best 17" MacBook Pro Deals, Low End Mac Deals, 08.26. Used 2.16 GHz Core Duo, $1,330; 2.33 C2D, $1,689; refurb, 2.4, $1,899; new, $2,099; 2.5, $2,558 after rebate; 2.6 Santa Rosa, $2,399 a/r; more.
- Best iPod shuffle Deals, Low End Mac Deals, 08.26. Refurb 3G 1 GB, $39; new 3G, $45; refurb 2 GB, $59; new, $68.
- More links in our archive.
Go to the Online Tech Journal index.
About LEM | Support | Usage | Privacy | Contacts

