Web Design Scribbles [ Page 2 ]

PHP/MySQL- Escape All POST Or GET Variables For MySQL INSERT
PHP/MySQL- Escape All POST Or GET Variables For MySQL INSERT

PHP/MySQL- Escape All POST Or GET Variables For MySQL INSERT

I’m quickly going to demonstrate how to escape special characters in a string for all POST/GET variables safe for a MySQL INSERT query when passing values from a HTML form. So, let’s say we have a form like this on index.php: Details First Name: Surname: Email: View Code HTML1 2 3 4 5 6 7 [...]



Maruf scribbled this post.
0
Feb 16th, 2010
MySQL – INSERT SELECT Example
MySQL – INSERT SELECT Example

MySQL – INSERT SELECT Example

I’m quickly going to demonstrate how to INSERT rows from one table into another table. I’d just like to clarify, this isn’t the same as completely copying a table, because with a INSERT SELECT query you can use the WHERE clause to INSERT rows with a particular condition (e.g. WHERE name = ‘Bill’). Whereas, copying [...]



Maruf scribbled this post.
0
Feb 14th, 2010
MySQL- Remove Duplicate Rows
MySQL- Remove Duplicate Rows

MySQL- Remove Duplicate Rows

I’ve been working with meduim sized tables (2.1million rows) in MySQL lately. One particular table had a lot of duplicate rows, which I needed to filter out. I’m quickly going to demonstrate how I did it. I’m sure there are many ways of doing this, but this method proved to be the easiest for me. [...]



Maruf scribbled this post.
4
Nov 22nd, 2009
Htaccess- 301 Redirect An Entire Directory / Folder
Htaccess- 301 Redirect An Entire Directory / Folder

Htaccess- 301 Redirect An Entire Directory / Folder

Here’s a simple pierce of code which will permanently redirect a folder / directory. For example, if you have a directory in the following path: http://www.example.com/pictures/, and for whatever reason decide to rename the directory to http://www.example.com/new-pictures/, the following htaccess code will safely redirect all users from /pictures/ to /new-pictures/ Redirect An Entire Directory / [...]



Maruf scribbled this post.
1
Sep 19th, 2009
PHP- Using Preg_replace To Strip Date From URL
PHP- Using Preg_replace To Strip Date From URL

PHP- Using Preg_replace To Strip Date From URL

This is a very specific problem I was faced with a few days ago, so I doubt many people will find it directly useful. However, the solution to this problem can be used to resolve a load of tricky regular expression issues. The Scenerio A client recently changed permalink structures for his entire website. For [...]



Maruf scribbled this post.
0
Sep 18th, 2009
SMF- Show Page Number In Thread Title
SMF- Show Page Number In Thread Title

SMF- Show Page Number In Thread Title

My God, I’ve only just recently started playing around with SM Forums, and I can honestly say the documentation is God awful. At least, it’s terrible compared to WordPress. Also, it’s not coded that great- even applying the simpliest of features require plugins (“mods”, as the SMF community call them) and/or hacks. Anyways, in this [...]



Maruf scribbled this post.
0
Sep 16th, 2009
PHP- Call Action In A Loop On A Set Multiple Value
PHP- Call Action In A Loop On A Set Multiple Value

PHP- Call Action In A Loop On A Set Multiple Value

This is one of those posts that is purely a reminder for myself. It’s something so simple, but for some reason or another, I tend to forget. Suppose I have a loop, and I want to call a certain action on every 5th loop. For example, on the 5th, 10th, 15th..etc count, I want to [...]



Maruf scribbled this post.
0
Sep 13th, 2009
WordPress- Display Google Adsense After 1st Paragraph Tag
WordPress- Display Google Adsense After 1st Paragraph Tag

WordPress- Display Google Adsense After 1st Paragraph Tag

I’ve been playing around with Google Adsense a lot lately- in particular trying to find out where the ads are best placed on a WordPress Blog to maximise click through rates (CTR). I’ve been looking at some wordpress plugins, but I couldn’t find any that allowed me to display an ad unit after the first [...]



Maruf scribbled this post.
7
Aug 23rd, 2009
Get a free quote