WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : normalize fields and strings used in where (command's Sql)
Categories : PHP, Databases, Oracle, Functions Click here to Update Your Picture
Jos� Santos
Date : May 23rd 2003
Grade : 5 of 5 (graded 2 times)
Viewed : 7458
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Jos� Santos
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

This function normalize fields and strings with or without accents, to where (commands sql).
This functions converts fields and strings with special characters into fields and strings with characters normalized and convert this to uppercase

<?php
function normalize($field,$string,$is_normalized,$type){

         
$characters_with_accents = "������������������������������"; // characters with accents
         
$characters_norm = "aeiouaeiouacouAEIAEOUAEIOUACOU"; // characters normalized

         
if ($is_normalized) // if is true, the field is normalized
             
$field_normalized = $field;
         else
             
// normalize the field
             
$field_normalized = "upper(translate
("
.$field.",'".$characters_with_accents."','".$characters_norm."'))";
         
         
$string_normalized strtoupper(strtr(trim
($string),$characters_with_accents,$characters_norm));
         
         if (
strcmp($type,"%like%") == 0) // the type of comparasion is 'like', in both sides (left
and right)
             return
$field_normalized." like '%".$string_normalized."%'";
         elseif (
strcmp($type,"like%") == 0) // the type of comparasion is 'like', in left side
             
return $field_normalized." like '".$string_normalized."%'";         
         elseif (
strcmp($type,"%like") == 0) // the type of comparasion is 'like', in right side
             
return $field_normalized." like '%".$string_normalized."'";                     
         elseif (
strcmp($type,"=") == 0) // the type of comparasion is '='
             
return $field_normalized." = '".$string_normalized."'";         
}
?>


Usage Example
<?php
$sql1
= "select * from people where ".normalize("name","S�nia Concei��o",false,"%like%");
$sql2 = "select * from keywords where ".normalize("key","web",true,"like%");
$sql3 = "select * from letters where ".normalize("first_letter","a",true,"=");
?>


This examples gives:
<?php
$sql1
= "select * from people where upper(translate(name,'�����������������������������
�','aeiouaeiouacouAEIAEOUAEIOUACOU') like '%SONIA CONCEICAO%'"
;
$sql2 = "select * from keywords where key like 'WEB%'";
$sql3 = "select * from letters where where first_letter='A'";
?>


This is very useful in command's Sql, and works fine with Oracle.
Is so mutch useful in search's where the field and respective string is not normalized.




Visits-tracking
Categories : PHP, Databases, MySQL, Errors and Logging, Functions
Simple class for accessing databases like MSSql Server, Oracle etc by Raju
Categories : PHP, MS SQL Server, Databases, PHP Classes, Oracle
StoredProcedure, Stored Procedure, Oracle, OCI8, OCI8i
Categories : OCI8, Oracle, Databases, PHP
Logs hits to any page which includes it. Automatically utilises page access information left behind by PHP/FI2.0.
Categories : Databases, PHP, mSQL, Databases
Function Query2Array will read an PEAR-DB-Query-Result into an Array. You may specify a Column used as Array-Keys, and you may specify the Number of Rows to skip at the beginning and the Number to fetch (-1 = infinite).
Categories : Functions, PHP, Databases
PHP CLASS for ORACLE (database connectivity)
Categories : PHP, PHP Classes, Classes and Objects, Databases, Oracle
This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
Connecting to Oracle with php3
Categories : Oracle, PHP, Databases
A database abstraction layer for the PHP Oracle 8 module (available from PHP 3.0.5). It supports persistent connections, fetching rows into arrays, prepare/execute (variable binding) and has a new and improved error interface.
Categories : Databases, Oracle, PHP, Arrays, Variables
How to access MS Excel spread sheets from PHP
Categories : PHP, Excel, ODBC, Databases
AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page.
Categories : PHP, AJAX, Databases, MySQL, Java Script
How to limit the number of records returned by an ORACLE query?
Categories : Databases, Oracle
Identify and log search engine access (spiders, robots, etc.) to a page.
Categories : HTTP, Environment Variables, PHP, MySQL, Databases
phpYellow Pages Standard
Categories : PHP, Complete Programs, Databases, Directories, Search
ifx_free_slob -- Deletes the slob object
Categories : Databases, Informix, PHP, PHP Functions
 Srikanth Turaga wrote :1045
Can someone send me either a working example of PHP and WSDL or atleast show me the link where I can find one. I have been trying a couple fo examples and none of them works. A working example (even a simple one would do) would be appreciated a lot.

Thank you,
Srikanth Turaga.