More Link Automation and PHP Frustration
Website Automation with PHP and MySQL, Part 15
Low End Mac Reader Specials
Memory To Go Special: New 2008 iMac 2GB $42 / iMac Intel Core2 DUO & MacBook Pro 2GB $36 - 1GB $20. MacPro 8 Core Memory 8GB kit $286 / 4GB kit $143 / 2GB kit $93 -- Free shipping available. LIfetime warranty.
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: OWC Mercury On-The-Go FW400/800/USB2/eSATA Portables High Performance A/V Rated, **Bus Powered** **Up to 500GB in the Palm of your Hand** Macworld Editor's Choice, CNET 'Very Good' - from $75.99!
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 $ 82 / 4GB $128 / 8GB $256 - Click to Maximize your Macs...
Dan Knight - 2002.07.31
Back in the Apple II+ era, my boss bought an Apple II+ system - and I discovered that I really enjoyed BASIC programming. AppleSoft BASIC was related to the Microsoft BASIC used by Commodore, CP/M machines, and most of the others.
The challenge was learning how BASIC worked by modifying programs, learning how the various dialects worked by converting them to AppleSoft BASIC (and later Commodore BASIC when I bought a VIC-20, GW-BASIC on my Zenith DOS machine, as well as Turbo BASIC and Quick BASIC).
Then I got a Mac, and I stopped programming - unless you count defining relationships between fields in Excel, FileMaker, and ClarisWorks programming. I never did get the hang of HyperCard and still don't understand AppleScript.
I don't pretend to understand PHP. I'm learning slowly, and I'm much less dependent on Brian and Steve for assistance, but when I need a fresh set of eyes to find a programming bug, one of them usually comes through.
I'm learning enough PHP to do what I want to do. And I've discovered that PHP isn't terribly well documented. A lot of the sample code I download from PHP.net doesn't work without some modification, and some of the information is simply wrong. That's frustrating.
Reading Email
My big programming project for the summer was going to be writing an email list management program that could handle dozens of lists while using a single subscription database. Anyone who runs a few busy lists probably knows the frustration of receiving "take me off your list" emails from subscribers who don't tell you which list.
That's one thing my program will address.
But instead of making progress, I've been stuck for almost a week trying to use the imap_open function. This is supposed to let me open a mailbox, then read and display the headers. Using the example on the PHP.net site (modified for my test address and password), I get error messages no matter what I do.
This is very frustrating, because I need to have this figured out before I can go anywhere with the project. And the imap_open function could also form the basis for creating a personal program to remove spam from my mailboxes.
More Low End Mac Automation
That may be frustrating, but this morning I began another aspect of automating things on Low End Mac.
When we publish new editorial content, we include a list of recent links at the end of the article. For some content, this is a generic "recent content" list, but for regular columns, we usually link to the 3 or 4 most recent articles in that series followed by other recent links on the site.
This morning I began automating that using pretty much the same techniques discussed in part 12. The big difference is a new section that displays the three most recent articles in that column (such as Mac Scope - our sample) and then recent links excluding those from that column.
I'm not going to post all the code, but here are the relevant parts:
- $get_links = mysql_query("SELECT * FROM links WHERE timestamp <= $rightnow and columnname = 'Mac Scope' ORDER BY timestamp DESC LIMIT 3");
- while ($array = mysql_fetch_array($get_links))
- {
- echo "<li><a href=\"$array[path]$array[html]\">$array[linktext]</a>, ";
- $shortdate = $array[pubdate];
- $shortdate = substr ($shortdate, -5);
- $shortdate = strtr ($shortdate, '-', '.');
- echo "$shortdate.
- $array[description]</li>";
- }
- echo "<li>More in the <a href=/musings/index.shtml>Mac Scope index</a>.</li>";
The first line finds the three most recent Mac Scope columns and sorts them in descending order by date. The subroutine displays the column title, link, date, and description. Since Mac Scope is always written by Stephen Van Esch, there's no need to display the author's name or the column title (Mac Scope) here.
The rest of the code is almost unchanged from what we came up with in part 12. The only real difference is excluding Mac Scope columns:
$get_links = mysql_query("SELECT * FROM links WHERE pubdate = '$latestdate[pubdate]' and timestamp <= $rightnow and columnname != 'Mac Scope' ORDER BY rank DESC");
The != is PHP's way of saying "not equal," which some languages write as <> and your math teacher probably taught you as an equal sign with a slash through it.
Once I had the script working properly, all I had to do was change the calls that had been made to a manually updated include file and instead call my PHP script. It works beautifully.
What Next?
For now, I'm pretty happy with how things are working. It'll take some time to get all of the sections updated with these new scripts, but there's no big hurry - nor is it a tedious job.
I'd eventually like to work on a submission system where writers could turn in articles online, maybe even writing some PHP to analyze content and take a stab at picking the best words to use in META tags. But there's no hurry.
The next big project will be Email List Automation Using PHP and MySQL. Assuming I can solve the imap_open problem.
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: Power Mac 7500, Aug. 1995 - This workhorse introduced a new desktop case and CPU daughter cards.
- List of the Day: G-Books is for G3 PowerBooks and iBooks.
- September 30 in LEM history: 98: They're making Mac viruses again - 99: No FileMaker 5.0 here - 00: Mac software resource page - 02: The value of .mac - Old Power Mac reaches 800 MHz - Spam and freemail - 05: Any real alternatives to the iPod? - Wireless broadband for older Macs - Hard drives here to stay - AirPort update improves security
Recent Content on Low End Mac
- What Is a Low-End Mac?, Simon Royal, Mac Spectrum, 09.30. By definition, a low-end Mac is enough Mac to do what you need to do without slowing you down significantly.
- Dell's Quad Core Workstation Notebook Shows Where Apple's 17" MacBook Pro Falls Short, Charles W. Moore, 'Book Value, 09.30. Inch thin notebooks have their place, but some users need more power and expansion options that current MacBooks simply cannot accommodate.
- Apple Innovation Includes Exploiting Existing Technologies Others Ignore, Alan Zisman, Zis Mac, 09.30. Among other things, Apple's 'think different' innovation means taking advantage of technologies that the PC industry has ignored.
- Taking Apart a Tray-Loading iMac, John Hatchett, Recycled Computing, 09.29. There are a few tricks to getting into a tray tray-loading iMac, whether it's to upgrade the computer or strip it for parts.
- $200 64 GB SSD for Your 'Book, Apple Steering Customers Away from MacBook Pro, and More, The 'Book Review, 09.26. Also how a $550 Windows notebook can cost over $1,200, netbooks may cut into MacBook sales, widescreens getting wider, bargain 'Books from $150 to $2,699, and more.
- Barriers to Mac Adoption Collapsing, Run Classic Mac OS on Windows and Leopard, and More, Mac News Review, 09.26. Also RIM promises new tools for Mac users, Chrome browser likely on Mac before Linux, take control of buying a Mac, iLovePhotos public beta, and more.
- 9 Browsers for G3 and Older G4 Macs Compared, Simon Royal, Mac Spectrum, 09.26. The latest versions of Opera, Safari, Shiira, iCab, Radon, Firefox, Demeter, Sunrise, and Camino that run on Mac OS X 10.4 "Tiger".
- iPhone 3G Power Adapter Recall, First Look at Android Phone, Newton Better than iPhone, and More, iNews Review, 09.26. Also confessions of an iPhone convert, slotMusic to replace CDs?, iPhone Configuration Utility, iPDA software updated, Sony's new iPod compatible boom box, and several new apps and cases.
- Best Power Mac G5 Deals, Low End Mac Deals, 09.26. Used 1.8 GHz single SuperDrive, $499; dual, $675, 2.0, $1,079; 2.3, $999; 2.5, $1,100; 2.7, $1,200; 2.5 Quad, $1,400.
- Best iPod nano Deals, Low End Mac Deals, 09.26. Refurb 3G/4 GB, $79; new, $116; refurb 8 GB, $99; new, $135; 3G/8 GB, $140; 16 GB, $190. Refurb and new prices include ground shipping.
- Best 17" MacBook Pro Deals, Low End Mac Deals, 09.26. Used 2.16 GHz Core Duo, $1,330; 2.33 Core 2, $1,699; close-out, 2.4, $1,700 after rebate; new 2.5, $2,549; 2.6 Santa Rosa, $2,399 a/r; more.
- More links in our archive.
Go to the Online Tech Journal index.
About LEM | Support | Usage | Privacy | Contacts

