|
|
|
|
|
|
| |
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.
|
|
| Logs hits to any page which includes it. Automatically utilises page access information left behind by PHP/FI2.0. Categories : Databases, PHP, mSQL, Databases | | | StoredProcedure, Stored Procedure, Oracle, OCI8, OCI8i Categories : OCI8, Oracle, Databases, PHP | | | Connecting to Oracle with php3 Categories : Oracle, PHP, Databases | | | Simple class for accessing databases like MSSql Server, Oracle etc by Raju Categories : PHP, MS SQL Server, Databases, PHP Classes, Oracle | | | Visits-tracking Categories : PHP, Databases, MySQL, Errors and Logging, Functions | | | 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 | | | 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 | | | PHP CLASS for ORACLE (database connectivity) Categories : PHP, PHP Classes, Classes and Objects, Databases, Oracle | | | 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 | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | Cut your MySQL Connections to 1 line of code Categories : PHP, Beginner Guides, Databases, MySQL | | | phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | |
| | | | 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.
| |
|
|
|