WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : 10035
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  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
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
StoredProcedure, Stored Procedure, Oracle, OCI8, OCI8i
Categories : OCI8, Oracle, Databases, PHP
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
Logs hits to any page which includes it. Automatically utilises page access information left behind by PHP/FI2.0.
Categories : Databases, PHP, mSQL, 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
Simple function to return the number of days in a time span between 2 given dates.
Categories : PHP, Date Time, MySQL, Databases
An SQL Administration User Interface for the Web
Categories : Databases, PHP, mSQL, Complete Programs
phpYellow Pages Standard
Categories : PHP, Complete Programs, Databases, Directories, Search
[PHP5] aDB PDO LIKE Database Abstraction. Switch easily from one db server to another, strong errors management, manage transactions, queries preparation and more.
Categories : PHP, PHP Classes, Databases, MS SQL Server, MySQL
Scripts to build APACHE - PHP and SQL 7.0
Categories : PHP, Databases, MS SQL Server
Dynamic WHERE CLAUSE depending on number of FORM FIELDS
Categories : ODBC, General SQL, PHP, Complete Programs, Databases
 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.