Hi everyone,
I am having some second thoughts about where to implement the caching part. Where is the most appropriate place to implement it, you think?
Inside every model, or in the controller?
Approach 1 (psuedo-code):
// mycontroller.php
MyController extends Controller_class {
function index () {
$data = $this->model...
I have a PHP site with a mySQL database that I'm working on. I'm running Apache, PHP, and mySQL on my development machine, and my code all works just fine. A week ago, I uploaded my code and database to my organization's web host (it's a non-profit group, so the host is not a dedicated in-house server, but rented space.) At that point, t...
I want to start by saying that I am a big fan of using foreign keys and have a tendency to use them even on small projects to keep my database from being filled with orphaned data. On larger projects I end up with gobs of keys which end up covering upwards of 8 - 10 layers of data.
I want to know if anyone could suggest a graceful way ...
Hi there,
Im trying to get the amount of elements in an array using the count() function, the result is a bit puzzling to me, considere the following example.
Assume that the user ID provided is wrong, and therefore had no matches, wouldnt then the result of the count function be 0? yet it is 1. can you explain to me why?
thanks
$q...
I wrote a recursive function, which returns an array with the paths to all files/folders in a given path. An array is already sorted and returns the exact information i want, but i struggle to display it properly in html lists.
Array_of_paths = (
[0] => /path/to/folderA/
[1] => /path/to/folderA/subfolderAA/
[2] => /path/to/folderB/
[3]...
I currently have PHP 5.3 in XAMPP. I need to run PHP 5.2 to run Zen Cart 1.8 (I'm aware of the patch - but still doesn't work). I would prefer to run it in the same XAMPP environent I'm currently running.
Is there a way to do this or do I have to reinstall XAMPP again with PHP 5.2 in another directory or something?
Appreciate all inpu...
What is the best way to get the first 5 words of a string?
How can I split the string into two in such a way that first substring has the first 5 words of the original string and the second substring constitutes the rest of the original string
...
Let's say I've started here:
$arr[0] = array('a' => 'a', 'int' => 10);
$arr[1] = array('a' => 'foo', 'int' => 5);
$arr[2] = array('a' => 'bar', 'int' => 12);
And I want to get here:
$arr[0] = array('a' => 'foo', 'int' => 5);
$arr[1] = array('a' => 'a', 'int' => 10);
$arr[2] = array('a' => 'bar', 'int' => 12);
How can I sort the ele...
I'm using namespaces in PHP for the first time in an application that provides a web service via Zend_Soap, and I'm running into a problem with the autodiscover feature. I have code something like this:
$autodiscoverObj = new Zend_Soap_AutoDiscover();
$autodiscoverObj->setClass('My\\Namespace\\MyClass');
And I'm getting errors like th...
I have a bunch of name-parentname pairs, that I'd like to turn into as few heirarchical tree dtructures as possible. So for example, these could be the pairings:
Child : Parent
H : G
F : G
G : D
E : D
A : E
B : C
C : E
D : NULL
Which needs to be transformed into (a) heirarchical tree(s):
D
├── E
│ ├─...
Hi everyone,
I have started to try APC to store some specific data on each webserver as an complement to memcached.
However, the following code piece is giving me headaches:
echo apc_store('key', 'value');
echo apc_store('key', 'newvalue');
echo apc_fetch('key');
// Echoes: value
Memcached example:
$memcached = new Memcached;
$m...
Hello,
I have the following .Net code which takes two inputs. 1) A 128 bit base 64 encoded key and 2) the userid. It outputs the AES encrypted token.
I need the php equivalent of the same code, but dont know which corresponding php classes are to be used for RNGCryptoServiceProvider,RijndaelManaged,ICryptoTransform,MemoryStream and Cryp...
How to find the time elapsed since a date time stamp like '2010-04-28 17:25:43', final out put text should be like 'xx Minutes Ago'/'xx Days Ago'
...
So I am working on a site for work that I "inherited" when I started here, and I am having to swim through a lot of code that i am unfamiliar with, namely soap services. The website has a feature that lets you write some things to the db using this createURL service:
$res = $db->Exec('INSERT INTO private_urls (UID, psswrd, profile_id, s...
I'm about to write a admin panel for my CMS written in CodeIgniter. There will be some user information visible at all time - both in the layout's header section and the sidebar. I'm used to do it in a way that I personally hope and think could be done a lot easier, since I'm tired of sending the same parametres to the view over and over...
I see the post http://stackoverflow.com/questions/2565864/validating-utf-8-in-htaccess-rewrite-rule and I think that is great, but a more fundamental problem I am having first:
I needed to expand to handle utf-8 chars for query string parameters, names of directories, files, and used in displays to users etc.
I configured my Apache...
I've just switched my scripts to a different server. On the previous server this worked flawlessly, and now that I've switched them to a different server, I can't understand the problem.
I'm not sure it would help, but here's the relevant code.
$headers = apache_request_headers();
PHP Version is: PHP 5.3.2
Any help would be appreciat...
This is quite a noobish question, I have searched for a few hours now and I know this has to be simple. I am using XAMPP and I am trying to learn some more about using PHP and mySQL together. When I create the DB and the table for information to store, I tried insert info to the table and it stores it as a .dat file rather than text. I k...
I have an online form which collects member(s) information and stores it into a very long MySQL database. We allow up to 16 members to enroll at a single time and originally structured the DB to allow such.
For example:
If 1 Member enrolls, his personal information (first name, last name, address, phone, email) are stored on a single r...
When I view the Sales report (Reports->Sales), it tells me I have 22 orders and made over $1000. When I view the orders (Sales->Orders), there are only 15 orders and I made a lot less.
Also, the dashboard only shows $737. Where are all these numbers coming from?
I'm using Magento 1.4.0.1.
...