Skip to content

Category Archives: Apache – PHP – MySQL

Finding Duplicate Records in MySQL

So I was needed to find some duplicate records in a table that had more than 3,000 records. I stumbled upon this query which made my life easier. SELECT `field`, COUNT(`field`) FROM `table` GROUP BY `field` HAVING ( COUNT(`field`) > 1 )

MySQL Search and Replace

This is definitely useful… UPDATE `<table_name>` SET `<field_name>` = replace( <field_name>, ‘<string_search>’, ‘<string_replace>’ ) ; Cheers!!

Ternary; which means this stuff ? :

OK, I needed to write this down as I do not use this comparison on a daily basis, but use it enough where its getting annoying that I have to research it every time I use it. So without further ado….. (expression) ? ‘do this if true‘ : ‘do this if false‘ Voila

OOP in PHP not the same as Java

We all know that PHP5 has a lot more OOP features than PHP4, and we all know that it is not a real OOP language. There are a lot of things in PHP5 that won’t work like Java (obviously). With that said, I just want to point out one feature that I noticed while playing [...]

Deny Users in a Directory and Allow Users in Subdirectory

It took me a while to figure this out. I wanted to deny the public access to a directory, like /deny and allow the public in a subdirectory like /deny/allow. This was done by the specific order of Allow, Deny. If you mix these up, you will either allow all or deny all. Anyway, here’s [...]

Free DNS Tools??

This is more a rant than anything to do with what I normally post, but I just had to post this!! In case you don’t know, I am a System Administrator for a web design company and I used to work in Tech Support for a hosting company. Since the beginning, I used dnsstuff.com for [...]

Error installing GD from php5-extensions using FreeBSD Ports

I’ve run into another problem installing Apache-PHP-MySQL FreeBSD server. While installing php5-extensions, I received an error when it tried to install GD. Here’s the error: ===> Patching for php5-gd-5.2.3 ===> Applying FreeBSD patches for php5-gd-5.2.3 ===> php5-gd-5.2.3 depends on executable in : phpize – found ===> php5-gd-5.2.3 depends on file: /usr/local/bin/autoconf259 – found ===> php5-gd-5.2.3 [...]

Search Engine Friendly URL’s Using Mod_Rewrite

Want to make http://domain.com/awesomepage.php?page=4&user_id=badass&action=go look like http://domain.com/awesome/page/4/user/baddass/go ?? To do this, you will need to use mod_rewrite in .htaccess or edit your Virtual Host in httpd.conf. Here is the code: Options +FollowSymlinks RewriteEngine On RewriteRule ^/awesome/page/([0-9]+)/user/(.+)/(.+)$ /awesomepage.php?page=$1&user_id=$2&action=$3 [NC] Yes, you will need to create more than one entry per page, but if you plan it [...]

What’s My IP Address

Since I have a dynamic IP address at home, I always have to look it up whenever I access anything that is IP restricted at work. All I do is run a simple code: echo $_SERVER[REMOTE_ADDR] Or you can check out my other page, http://topherdotcom.com/scribble/what-is-my-ip-address/ to see your own IP address. Done!!

Can’t Install mysql50-server Through the Ports?

I’ve been trying to install mysql50-server via ports, but have been getting a checksum error, like this: => MD5 Checksum mismatch for mysql-5.0.41.tar.gz. => SHA256 Checksum mismatch for mysql-5.0.41.tar.gz. ===> Giving up on fetching files: mysql-5.0.41.tar.gz mysql-5.0.41.tar.gz Make sure the Makefile and distinfo file (/usr/ports/databases/mysql50-server/distinfo) are up to date. If you are absolutely sure you [...]