php

AS3: What's newer/better than AMFPHP

I'm aware that AMFPHP has long been used to connect php with flex. I remember I read somewhere that there's something better now, but I didn't take a note of it, and of course now I forgot. Does anyone know what that could be? ...

Doctrine quoting apostrophes

I am using Doctrine ORM for php and Zend MVC. I have a mysql database. When I insert into the database it is escaping quotes. In other-words when I enter <input name="customer_name" value="Test'ed user"> ... into my form, and assign to a doctrine object and save. When I look at the database through the mysql command line I get Tes...

Combining XmlWriter objects?

The way my application is structured, each component generates output as XML and returns an XmlWriter object. Before rendering the final output to the page, I combine all XML and perform an XSL transformation on that object. Below, is a simplified code sample of the application structure. Does it make sense to combine XmlWriter objects...

CakePHP add/edit form is working, except for foreign key references

I have a cakephp object (SecurityPerson) that has a few foreign key relationships to other objects. Here's the add/edit view code that's generating the pulldowns for the foriegn-key references: echo $form->input('ContractNumber'); echo $form->input('Location'); Here's the references to these objects in the model: var $belongsTo = ar...

How can I change my DocumentRoot without breaking PHP?

I had my development machine set up just fine and everything worked perfectly. But then I needed to shuffle some folders around and in doing so needed to change my apache document root. It was d:/htdocs It is now d:/web/htdocs I've updated it both times in httpd.conf; at DocumentRoot d:/htdocs and <Directory "d:/htdocs"> The problem i...

best way to determine lower/uppercase in PHP?

I have a string that is one of the following forms ABC // all caps: // not necessarily "ABC", could be any combination of capital letters Abc // first letter capitalized, rest are lowercase abc // all lowercase and I need to distinguish which of these three cases it is... what's the best way to do this? There doesn't seem to ...

counting session units from array PHP

Hey. I want to count my $_SESSION['cart'] (units) products from my basket. #check added stock $units = (int) $_POST['units']; $sizes_id = (int) $_POST['size_id']; $in_stock = $db->GetScalar("SELECT p.units FROM products_sizes s INNER JOIN products p ON p.product_id = s....

Connecting to a remote computer - desktop

I want to be able to connect (from a server) to a remote PC and be able to access it's files. I am trying to do this with PHP or JavaScript. So I am wondering if 1) it's possible and 2) how to do it. Does anyone have any examples/solutions? Thanks! ...

Serialized data in mysql database needs to combined in an array

I am working in PHP/MySQL. I have a table in my database called hourly in that table their is a column named webaddress these are serialized. There are multiple rows of each column of webaddresses each is serialized. I need to pull each row, unserailize them then put them into an array. I tried using this bit of code but it only gr...

Implementing a dynamic sidebar in zend without calling an extra action

Currently trying to come up with a "best practice" for a ZF site that is both elegant and efficient. What I am trying to do is just generate data for a sidebar. In a couple of related questions and on other sources, the approach taken was to call another action from the sidebar part of your layout, or to add the sidebar action to an act...

PHP: using => operator without an array

Is there a way to use the PHP => operator (?) without using the array() "constructor"? To be specific, I want to create a function that will get a list of keys and values without wrapping it into an array: function keysAndValues($items) { /* ... */ } keysAndValues( 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'val...

php multidimensional arrays and foreach

Hi everyone I am having an oddity where in my foreach loop the last element is the same as the 2nd to last Here is my code so far php code (pastbin site) I threw a print_r just before the loop to see if it was an error in the construction of the array, but it prints out everything just fine. (sorry I cant post more than 1 link ) here...

Does an 'Email' class belong in model or view?

I have a User class in the model and need to send a password reminder email. Does the controller instantiate a User and pass it (or values from it, rather) to a Email class in the view? In which case, would the controller then do the actual sending of the email? Or would the controller call User::sendEmail() and there not even be a vi...

<!-- --> comment brackets in PHP

I just found out you can use <!-- --> brackets in PHP to inject commands in unsecured forms. I couldn't find any information about these brackets in PHP. I know they're used in XML structures. I tried googling but google simple escapes those brackets. Are they similar to /* */ comments in PHP? Edit: Here's where I found out. http://na...

Dynamically adding HTML fields with Javascript and CodeIgniter

I've been having a lot of troubles with this for the past few hours right now and I'm really not seeing where the problem is. Every single code snippet I find on the Internet is telling me I'm doing it right, but for some reason, nothing is working. Basically, I have a form that requires fields to be dynamically added depending on the n...

how can i split date form Date of string formate using flex ?

my date of string like (2009-12-03 21:05:00) date with time . so i used to store var newdate:Date=new Date(Date.parse(startdate)); but shows some errors. and also i tried to split string(date) used date function like var datenumber:Number= (new Date(Date.parse(startdate))).getDate(); not get the date how can i split particular date ...

Count(id) in MySQL into a string

Hello, I have the SQL query: $query = "SELECT yearoffiling, COUNT( id ) FROM files GROUP BY yearoffiling LIMIT 0 , 30"; How do I put the values from COUNT(id) inside a string? Thank you. ...

Calculating revenue share at different tiers

I'm trying to write a function that can calculate revenue at different tiered levels... For example you sell $10000 worth of widgets. Any earnings from $1 - $999 we take 50%, $1000 - $4999 we take 25%, $5000 - $9999 we take 10%, $10000 - $19999 5%. The percentage is not taken based on the final value. So if you earned $10000 you don't ...

Construct a PHP variable name based on other variable values and static text

I want to tell my function which variable to call based on the day of the week. The day of the week is stored in $s_day, and the variables I want to call changes based on which day it is. e.g. I've stored a string 'Welcome to the week' in $d_monday_text1. Rather than build a set of 7 conditional statements (e.g. if date=monday echo $fo...

Feasibility of HAML + PHP/CakePHP

Is anyone using a HAML implementation for PHP like phpHaml or pHAML? Both projects have seen no activity for about 2 years, and both are < 1.0. Is it feasible/wise to use HAML for a large PHP application, or is it too immature? Does anybody have experience with Chaml for CakePHP? I played around with it, and it seems to be really picky ...