Login   Register  
PHP Classes
elePHPant
Icontem

File: SQLEncode.inc

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michael J. Fuhrman  >  Ladder PHP  >  SQLEncode.inc  >  Download  
File: SQLEncode.inc
Role: Documentation
Content type: text/plain
Description: This contains the SQLEncode Command
Class: Ladder PHP
Manage objects stored MySQL database dynamically
Author: By
Last change: Informed users which file this code segment should be placed in.
Date: 5 years ago
Size: 513 bytes
 

Contents

Class file image Download
Ladder PHP requires SQLEnclode or mysql_real_escape_string to be used to encode SQL calls.  mysql_real_escape_string is faster, as it's compiled into PHP.  

Add the code below to your Functions.INC file.


Function SQLEncode ($szString)
{
   $szRtn = "";
   $nlen = strLen($szString);
   If ($nlen == 0) return;

   For ($t = 0; $t < $nlen; $t++)
   {
      $szChar = substr($szString, $t, 1);
      $szRtn .= $szChar;
      If ($szChar == "'") $szRtn .= $szChar;
   }

   return ($szRtn);
}