php5

oci_bind_by_name buggy with TO_DATE SQL function

Hi all, I have a strange issue today related to the oci_bind_by_name function I use in PHP. Let me give you a showcase. Here is a table with simple dates: create table test(col1 date); insert into test values(to_date('01/01/2009','DD/MM/YYYY')); insert into test values(to_date('01/01/2019','DD/MM/YYYY')); insert into test values(to_d...

Need a way to check to see if a wildcard string matches a given string in PHP

I am trying to figure out how to create a function where I can pass in two strings, one with wildcards and another that is checked to see if it matches the wildcard string. $wildcard_string = '*.example.com/some/path/*'; $test_string = 'dev.example.com/some/path/art123.html'; function test_wildcard_match($wildcard_string, $test_string...

PHP DOM Get <option> Tag That Is Selected

So let's say the HTML looks something like this: <select name="some_name"> <option value="1">1</option> <option value="2">2</option> <option value="3" selected="selected">3</option> <option value="4">4</option> </select> I need to extract the option tag with attribute selected="selected" from there. How can I do that? ...

Zend_Cache And UTF-8 Problem

I'm trying to save UTF-8 characters with Zend_Cache (like Ť, š etc) but Zend_Cache is messing them up and saves them as Å, ¾ and other weird characters. Here is a snippet of my code that saves the data to the cache (the UTF-8 characters are messed up only online, when I try it on my PC on localhost it works ok): // cache the external d...

SOAP Server error in PHP - adding functions from a class

I am writing a SOAP server and have hit a strange problem. Here's the relevant lines from the server.php class MyHandler { public function __construct() { ... } public function __wakeup() { ... } public function getPrice() { ... } } $server = new SoapServer("my.wsdl", array("soap_version" => SOAP_1_2)); $server->setClas...

Add 'Watermark' to images with php

I have a website where users may upload images... I need to add my logo (watermark) to the images once they are uploaded. How can I do so? And it is important that the watermark is in a corner where it will be visible, for example I have seen websites which generates a watermark on the fly, and puts the mark wherever the background of...

Convert the code in PHP to C#

What is C# equivalent of include function in php??i have to convert the following code in php to C# if (file == "") file = str_replace(" ", "", family).strtolower(style) + " +ok sir php"; if (defined("FPDF_FONTPATH")) file = FPDF_FONTPATH + file; include(file); ...

PHP PDO search engine with relevancy

Hi, I'm desperately trying to create a relatively concise search engine with PHP, mySQL and PDO. I have a database of books, and I'm trying query a search against two of the fields. Here is what I have so far: "SELECT id, title, author, isbn, MATCH(title, isbn) AGAINST (:term) AS score FROM %sbooks WHERE MATCH(title, isbn) AGAINST (:te...

Cannot execute crontab command from a php script...from shared host....

Hi, I'm running an application where I need to execute the cron job, once a form is submitted,contains more than 1 lac records in a loop(its on-demand execution of cron job and deletes the job once finished). I'm using php, I tried to configure the job through cpanel as a test and it works...the command was.."/ramdisk/bin/php5 -f /home/...

How can I "think" in OOP ?

I am learning php5 and have covered all the basics concepts. Now to do the actual work. I realize the biggest challenge for me is dividing and organizing which classes should do what; I am stuck. With proecedural, I would be half done by now... What are some rules of deciding how many objects you should be using? Do you divide to sma...

file_get_contents() Breaks Up UTF-8 Characters

I am loading a HTML from an external server. The HTML markup has UTF-8 encoding and contains characters such as ľ,š,č,ť,ž etc. When I load the HTML with file_get_contents() like this: $html = file_get_contents('http://example.com/foreign.html'); It messes up the UTF-8 characters and loads Å, ¾, ¤ and similar nonsense instead of proper...

Why Does DOM Change Encoding?

$string = file_get_contents('http://example.com'); if ('UTF-8' === mb_detect_encoding($string)) { $dom = new DOMDocument(); // hack to preserve UTF-8 characters $dom->loadHTML('<?xml encoding="UTF-8">' . $string); $dom->preserveWhiteSpace = false; $dom->encoding = 'UTF-8'; $body = $dom->getElementsByTagName('body...

building dynamic form in cakephp

I'm trying to build a form dynamically based on the field and its definitions stored in a XML file. In my xml, I have defined 1 checkbox with some label and 1 textfield with some label. How do I build a form dynamically based on what I have in my xml. I dont want to create any models. ...

Magento; private/public filesystem layer

I want to split up the magento package in a private and public web directory. E.g. the private directory is reuseable on multiple projects, its just the app. private/ app, downloader, includes, lib, pkginfo, var public/ 404, js, media, report, skin + current root files (index.php etc.) Im setting this up in SVN where just one cop...

How to convert XML element data into PHP numeric array

I'm not really a web developer and I'm trying to make a web interface for parsing and displaying experimental data, so I apologize if this is a ridiculously easy solution. I'm trying to take data from an XML element and convert it into a PHP numerical array that I can plot using GD. So far, I have the XML creation, XML loading, and GD ...

Oracle SP array parameter in php

I'm calling an Oracle Stored procedure which takes an array as an input parameter. Owa.vc_arr(varchar2) I'm making a call in php and getting an error. Any help would be greatly appreciated. Code which i'm using is given below. function findSupplier($ptype) { $proCall = 'BEGIN ICPISSAAPILIB.FIND_SUPPLIER(:P_PRODUCT_TY, :P_RESULTS); E...

Install PHP 5.3 on Leonarp - Mac OS X 10.5.8

I was trying to update from php 5.2 to php 5.3. Basically what I did is I download the php 5.3 Package from entropy.ch and ran the package. Everything installed successfully. Now, when I try to run local pages. For those that are calling mysql queries, I get blank pages as a result. Looking at the apache2 error logs, I see the followin...

PHP5.3 is not working with MySQL5.1 IIS7 Times out

I have set up PHP5.3, MySQL5.1, and IIS7 on Window 7 but php doesn't want to work with MySQL. I'm assuming it is a configuration error or an incomplete install on my part. MySQL5.1 is working PHP5.3 is working, phpinfo() shows info and that i have enabled MySQL IIS is setup and using fastCgiModule to run PHP IIS registers php.ini...

Total number of built-in functions in php?

Hi, does any one know how many built in functions are there in PHP (latest version)? Thanks ...

How do I modelize my two classes knowing one needs the method of the other?

Hello, I have these two classes and the class Retrodoc needs to know the versionPath() to execute its method run($versionId). So what is the best modelization? Do I instanciate Version in the method and then I can use the method getVersionPath()? Thanks in advance. ...