php5

Resolving conflict between multiple jQuery files

I have multiple jquery files in my project. I am using facebox using jquery1.4.2 but i need prototype and scriptacolous scripts too. I have used jQuery.noconflict(); in my code but its not working. this is the url http://mlep.com/~avalon/wordpress/ideas-and-insights/case-studies/. ...

Class method calling other class method without include/require ?

I have no clue how to phrase this question in a search engine. I'm a bit confuse how classes use other class's methods without include/require. I've seen this in PHP a couple of time now. Coming from C++ background, I had to include everything in order to use it, so it's a bit confusing. But ok here we go: Say i have improve_db_connec...

file upload problem

hi i am working in php. when i upload a file before uploading i just print the file array by using print_r($_FILES); it will print following array. [image] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) ) so whats reason besides it that will not give actual file attributes. please help me. thanks ...

Including CSS in an email sent from a task in symfony

I am attempting to send an HTML email from a symfony (1.4.6) task, I don't want to send the entire rendered HTML output from a particular module/action, so I am rendering a partial. That's all fine, the issue is that the partial contains CSS references. Is there a nice 'symfonic' way of including a CSS file in an HTML email from a symfo...

Caching strategy, when does caching become pointless?

I'm pretty new to caching strategies and implementations. I'm working on a project that will be database intensive, but also have information being updated and changed very regularly. I've found enough info to know generally how to develop the caching function, but what I'm unsure about is the general strategy. If I cache all query r...

Sending the Variables from Layout to comtroller and view in zend framework

I have a php array defined in "layout" known as default.phtml and that array is some thing like this $mydata['abc'] = array("A","A","A","A","A","A","A"); I can get the Layout using a custom defined function $cls = new cass(); $layout = $cls->getLayout() ; How do i access the same array "$mydata['abc']" in the Controller and vie...

How to generate unguessable "tiny url" based on an id?

Hi there, I'm interested in creating tiny url like links. My idea was to simply store an incrementing identifier for every long url posted and then convert this id to it's base 36 variant, like the following in PHP: $tinyurl = base_convert($id, 10, 36) The problem here is that the result is guessable, while it has to be hard to guess...

php xml function requirements

I am using simplexml_load_string() function to read XML but by this no result is there there is a blank page Please if you have any other method for this please tell me Thanks ...

how to make tree model?

how to make tree model? ...

php arrays finding the elements present in all sub-arrays

I have a php multidimensional array (2 levels) with some values and I want to identify what values are present in all arrays. Array ( [1] => Array ( [0] => 1 [1] => 3 ) [2] => Array ( [0] => 1 [1] => 2 ) [3] => Array ( [0] =...

ACL implementation

Hello, First question Please, could you explain me how simpliest ACL could be implemented in MVC. Here is the first approach of using Acl in Controller... <?php class MyController extends Controller { public function myMethod() { //It is just abstract code $acl = new Acl(); $acl->setController('MyController'); ...

Diff between STREAM_CLIENT_CONNECT and STREAM_CLIENT_ASYNC_CONNECT

Hi I am new to php, i know to difference between STREAM_CLIENT_CONNECT and STREAM_CLIENT_ASYNC_CONNECT flag in Stream_Socket_Client(). ...

sql date hour conversion

I have SQL like this: `table1`.`DateField` >= DATE_SUB(NOW(), INTERVAL {$days} DAY My table1.DateField is in the format of 2010-03-10 10:05:50. The value of {$days} could be 4 hours or 3 days. How can I make the above sql smart enough to know that? Should I use `table1`.`DateField` >= DATE_SUB(NOW(), INTERVAL {$days} DAY_HOUR ...

How to avoid big switch statements?

I have an internal application in which one function is containing too many switch cases. This is developed in php.This specific function is used to write changes to database and also to keep a history of individual field values. So what it does is have a case for each field as different things needs to be applied for different fields...

Are there any instances when the destructor in PHP is NOT called?

Hello everyone! :) This is my first time posting to stackoverflow, but I these threads have helped me tremendously! Anywho, onto my question... are there any instances when the destructor in PHP is NOT called? The reason I ask is because I have a mapper class which maps data to objects and in the constructor, I start a transaction and ...

Simple XML - How to select all elements which have a specific attribute value

A user can select a performance, so the performance elements have unique ID's. I want to basically say: Select all reservations->reservation['seat'] FROM performances->performance['id=2']. Hope that makes sense, I really am struggling with selections in simple XML. Thanks in advance, Henry. <performances> <perform...

OpenID AX, Google and mod_rewrite problem

I am trying to implemented an OpenID for our project(Zend, PHP, Apache), and hitting a weird problem. After user authenticates at the provider's side and is sent back to our website, apache gives 500 Internal Server Error response. Logs are completely blank. I've noticed though that when using OpenID AX with Google, they returning way to...

Where clause with Zend_Db not working as expected

I am getting an error: Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'Chinese'%) ORDER BYtext_idDESC LIMIT 10' at line 2 caused by this line of code $select = $this->_db->select('')...

MySQL/PHP 5 - getting the ID of the last fetched row

I am trying to create a look-up table from the results which mysql_fetch_assoc returns, and this is the code I have so far: protected function dumpResultAsHash($primaryKey) { if (empty($primaryKey) || !isset($primaryKey)) throw new Exception("Primary key cannot be null or not defined!"); $resultset = array(); while...

get values in url

I need to get values in the url as it is ex: http://www.example.com/index?url=1+LY2ePh1pjX4tjZ4+GS393Y2pjd16Cbq63T3tbfzMzd16CarA== but vriable url give me value of "1 LY2ePh1pjX4tjZ4 GS393Y2pjd16Cbq63T3tbfzMzd16CarA==" Even though i have expected "1+LY2ePh1pjX4tjZ4+GS393Y2pjd16Cbq63T3tbfzMzd16CarA==" any one can help me for this o...