php

How do I find out what PHP library module is required for a function?

I wonder, how am I supposed to know which libraries I should include in my php.ini file when using a certain function. For instance, I just looked up pg_connect(), and I wonder which libraries I should include. I can think of php_pgsql.dll, but that's about it. Do I need others? I wouldn't know, since that doesn't seem to be documented...

Wondering how to do PHP explode over every other word

Lets say I have a string - $string = "This is my test case for an example." If I do explode based on ' ' I get an Array('This','is','my','test','case','for','an','example.'); What I want is an explode for every other space: Array('This is','my test','case for','an example.'). The string may have an odd # of words, so the last item in ...

Stripping everything but alphanumeric chars from a string in PHP

I'd like a regexp or other string which can replace everything except alphanumeric chars (a-z and 0-9) from a string. All things such as ,@#$(@*810 should be stripped. Any ideas? Edit: I now need this to strip everything but allow dots, so everything but a-z, 1-9, .. Ideas? ...

Nested sets, php array and transformation

Hi, I need to transform my nested sets structure (mysql) into json for this spacetree 1) http://blog.thejit.org/wp-content/jit-1.0a/examples/spacetree.html I found this function to create an array from nested sets: 2) http://semlabs.co.uk/journal/converting-nested-set-model-data-in-to-multi-dimensional-arrays-in-php I can also convert...

Data Sanitization in PHP

Can someone recommend an up to date library for data Sanitization in PHP ? I am looking for a library that proposes a set of functions for data sanitization. Email validation/sanitization (remove those %0A, \r...), strip htlm (stripslashes(htmlentities), remove script, SQL injection … any form of exploit related to data submitted by use...

Looking for a set of tools/objects to start a website in PHP

Looking for a good set of base objects to start a website up in PHP. I am not looking for links to CakePHP as I am not interested in frameworks. I am looking for a set of objects that would come handy to start off with for new projects... Objects such as: Loggers MySQL wrapper object etc Basically a "Start with this", I remember s...

AOL OpenID?

I'm trying to implement OpenID on my site. I've got Google, Yahoo! and ClaimID working so far, but AOL tells me "Invalid devId or Site not registered.". So how do I register my site and/or get a devID and pass it along? I'm using JanRain/PHP OpenID. AOL's dev blog is just a mess. ...

Different AJAX XML results from same PHP file with same POST parameters using JQuery

I'm using the JQuery .ajax method to get the results of a simple PHP query in XML (which I've done various times within this project without a problem). However, the XML result that I receive from within my main project is different to what I expect (as tested by simply viewing the PHP file) when viewing the results in Firebug's console...

PDO Unbuffered queries

Hello guys, I'm trying to get into PDO details. So I coded this: $cn = getConnection(); // get table sequence $comando = "call p_generate_seq('bitacora')"; $id = getValue($cn, $comando); //$comando = 'INSERT INTO dsa_bitacora (id, estado, fch_creacion) VALUES (?, ?, ?)'; $comando = 'INSERT INTO dsa_bitacora (id, estado, fch_creacion)...

PHP: exceptions vs errors?

Maybe I'm missing it somewhere in the PHP manual, but what exactly is the difference between an error and an exception? The only difference that I can see is that errors and exceptions are handled differently. But what causes an exception and what causes an error? ...

Why a very good PHP framework - Qcodo (or Qcubed - its branch) - is so unpopular?

I am wondering why this framework (QCodo) is almost forgotten and totally unpopular. I've started using it a few years ago and it is the only thing that keeps me with PHP. Yeah ... its development is stuck (that's why there is now more active branch Qcubed) but it is still very good piece of software. Its main advantages: Event driv...

PHP Syntax error with Youtube API: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

I keep getting this error in line 54 and I don't know why. All that I'm trying to do is to process the first entry of the query result: extract it's URL so as to construct an embeddable video object. <?php function extractID($youtubeURL) { //split off the final bit of the URL beginning with ‘=’ $youtubeID = strc...

Reading Data From $_POST[] in PHP

Hey guys, I'm trying to read POST data in a PHP script. My first instincts led me to the $_POST[] array, but for whatever reason, it's never populated. I'm using HTTP Client for OS X, http://ditchnet.org/httpclient/ to send POST requests. I enter the URL of the script, set the method to POST, set the content-type header to text/plain ...

PHP Netbeans - New Project from Existing Sources asking for an Index file?

I'm trying to create a new project in NetBeans PHP from existing sources. When I try to create a new project, it asks me for the location of an Index File. What is an Index File in the context of NetBeans? ...

Doctrine profiler does not catch queries

I think I must be missing something obvious here. I have Doctrine and Zend Framework set up together. In the bootstrap.php file I have the following - based on the Doctrine documentation for using the profiler: $profiler = new Doctrine_Connection_Profiler(); $conn = Doctrine_Manager::connection(); $conn->setListener($profiler); (...) ...

Should I write my own CMS?

I am planning to begin working on my first personal project this June: a community about students. What I want to have is a wiki, full with information about universities, a forum where people can discuss and a blog with news, articles, etc, all three of them integrated to eachother. Now, the way to go seems like wordpress+mediawiki+som...

Comparing Rails vs. PHP to a non-technical audience

I recently had an interview at a small company that wants to greatly increase its web presence, including re-writing their Flash homepage and opening an e-commerce site. If given the position, I would be the sole developer on staff. I've been working with Rails for a number of years, and haven't looked at PHP in quite some time. However...

Cant find the Error in this Php piece of code

Im getting T_String error on this code, its saying more accuratly on the 2nd line ($form['com...) and i simply cant see why. function _maxlength_comment_type_form_alter(&$form, $form_state, $form_id) { $form['comment']['comment_max_length'] = array( '#type' => 'select', '#title' => t('Maximum comment length'), '#defau...

File rewrite not working?

test.php <?php $filec = fopen('test.txt','w'); $arr = file('test.txt'); foreach ($arr as $key => $value) { fwrite($filec,$value); } fclose($filec); ?> test.txt asdjlaksjd asdhfwejkyhtjkre jfdhgdjkf'hgjldsff sfjnkbnm,cv sm,nxcm,b, sdjlhfskld jfsdfwerwlur slfdjsdkljfklsdjf When I run test.php, test.txt is emptied. Does anyone ...

Banner Impressions Tracking - Database Design

Hi Folks Looking for some good advice on db design for tracking multiple banner impressions. IE I have 5 Banners over x Domains I would like to build data on each banner on how many impressions per day per banner etc. So also be able to do lookups for other date ranges. Would it be best to have a date per day per row or just track ea...