php

Evaluating PHP Code

I am very much a beginner when it comes to using PHP. I was given this code, to try and output the contents of a files on a folder, onto a server, but my issue is I do not know how to read and alter this code to fit my specific file path. Can someone help me out with this, and lets just use the name folder as an arbitrary pathname. ...

PHP's strtotime() in Java

strtotime() in PHP can do the following transformations: Inputs: strtotime(’2004-02-12T15:19:21+00:00′); strtotime(’Thu, 21 Dec 2000 16:01:07 +0200′); strtotime(’Monday, January 1st’); strtotime(’tomorrow’); strtotime(’-1 week 2 days 4 hours 2 seconds’); Outputs: 2004-02-12 07:02:21 2000-12-21 06:12:07 2009-01-01 12:01:00 2009-02-...

Kohana -- User Registration Runtime Error (auth)

I'm implementing the auth module in Kohana, and I can't seem to figure out the source of this error message--it happens when I submit a registration form that creates a user in the database (which it successfully does). An error was detected which prevented the loading of this page. If this problem persists, please contact the websi...

create ini file, write values in PHP

I cannot find a way that easily lets me create a new file, treat it as an ini file (not php.ini or simiilar... a separate ini file for per user), and create/delete values using PHP. PHP seems to offer no easy way to create an ini file and read/write/delete values. So far, it's all just "read" - nothing about creating entries or manipulat...

Can I query other databases from within Wordpress using PHP/mySQL?

I have a site that is a mix of Wordpress and other PHP pages. Can I query the other database and have the results show within Wordpress? ...

How do I handle multiple datasources?

I am working on a web application (PHP + Doctrine + MySQL) to sell. The problem is that there is information that the clients will need from my central data source and they will have information that they don't want me to see (financial and such). My Question, what is the best way to get that information to the customer application? My...

How to decode a JSON string in PHP?

I have a JSON string that looks something like this: {"addresses":{"address":[{"@array":"true","@id":"888888","@uri":"xyz","household":{"@id":"44444","@uri":"xyz"},"person":{"@id":"","@uri":""},"addressType":{"@id":"1","@uri":"xyz","name":"Primary"},"address1":"xyz","address2":null,"address3":null,"city":"xyz","postalCode":"111111"}]}} ...

Using Eclipse 3.5 PDT, how do I stop it from automatically converting <? into <?php ?> ?

I just upgraded to Eclipse 3.5 PDT, and everytime I type <?, it converts it into <?php ?>. How do I turn that off? ...

Is it better to set variable in the view or the controller in Zend Framework?

My question needs a bit of setup, so please bear with me: I became a convert to using View Helpers for getting data from a model rather than sprinkling it all over the controllers (hat tip to Eric Clemmons). It's much more reusable and flexible there. I just love it! What I usually do, is lay out the template in the index.phtml, and th...

php strlen function and 2 vars

if (strlen($title) > 2 && ($msg) > 2 && ($email) > 2)) { //true } else { //false } What would be the correct way of checking more than 1 var? This wont work..tried many ways ...

Request params and phpdoc

Trying to figure out the best way to document request parameters via phpdoc in a manner that makes sense. Specifically, I've got some Zend Framework controller actions that receive parameters via GET/POST, but aren't functional params. Does this make sense? /** * Display a pagination/grid list of rows. * * @param string $_GET['order'...

PHP Limit string output by specific characters

Hello, I am trying to limit the number of characters returned from a string using PHP. I've applied a solution that just seemed to crash the server (high load) / infinite loop. So I am asking for alternative, Simply, I am trying to find a solution that cuts the string, display specific amount of characters, but still respect the meanin...

What would be considered average or high load for a website using mysql on the backend?

I'm roughly 10% into my website project and I'm trying to figure out what sort of load I'm putting on the database. When a user is logged in, I have many functions that trigger every minute, and every time someone visits the page, a number of elements, such as area code lists, states and countries are pulled to build a registration page...

Some uploads fail in PHP

Hi guys, I have a problem with php file upload, so..when I try to uploads some songs, they work, but some song don't work..so the problems is that php doesn't see my upload filed, if i try: if (isset($_FILES['song'])) { //lala }else{ echo 'no song'; I receive an echo with "No song",so here you have a firebug screenshot http://screenc...

Custom URL rewrite in wordpress

Hello all, I am trying to achieve a custom URL structure with Wordpress. Basically, my site functions as my blog and my portfolio. I want to have an "Articles" section and a "Portfolio" section. I want the articles to display on the Articles page, and the portfolio on the Portfolio page. Should be easy, except on top of that I want cust...

How do I tell DOMDocument->load() what encoding I want it to use?

I search for and process XML files from elsewhere, and need to transform them with some XSLTs. No problem. Using PHP5 and the DOM library, everything's a snap. Worked fine, up till now. Today, funky characters were in the XML file -- "smart" quotes from Word, it looks like. Anyways, DOMDocument->load complained about them, saying that th...

How to setup apache and php to make mail() function work on local machine

Hi. I am using php's mail() function to send an email from a php scrpit, however, this is not working. I believe the problem is with my php setup and the lack of an smtp server. Does anyone have experience with setting something like this up on a local machine and what can be done to fix this? Thank you ...

Proper syntax for substituting in php?

Beginner question. How do I substitute: $_SESSION['personID'] for {personID} in the following: public static $people_address = "/v1/People/{personID}/Addresses" ...

How to create an array from a CSV file using PHP and the fgetcsv function

Can someone kindly provide a code to create an array from a CSV file using fgetcsv? I've used the following code to create an array from a simple CSV file, but it doesn't work right when one of my fields has multiple commas - such as addresses. $lines =file('CSV Address.csv'); foreach($lines as $data) { list($name[],$address[],$status...

How to Print Hexadecimal Numbers in PHP or Java

I need to print some data (a little bit strange formatted). I was writing it in PHP with if ($num%10==9) but it was impossible for me to get correct output. So take a look at this for example. We have x of files in folder. For this example x=36. X is always known. Output should look like this: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e...