php

Speed of data manipulation in PHP vs MySQL

Apologies in advance if this is a silly question but I'm wondering which might be faster/better in the following simplified scenario... I've got registered users (in a users table) and I've got countries (in a countries table) roughly as follows: USERS TABLE: user_id (PK, INT) | country_id (FK, TINYINT) | other user-related fields... ...

Is it possible to use Wordpress API to make posts on wordpress.com?

I'm aware that the wordpress API can be used to make posts to wordpress blogs hosted on your own server/website. However, is it possible to also make posts to blogs hosted on wordpress.com using the api? If so, where can I find the details such as the URLs to which to make the api requests, etc? Currently I'm only interested in adding n...

writing to log file causes error 704

Hello, Does anyone know what this error means FATAL: Autorisation no longer valid.704 It happens when I try to write to this file, but the permissions are set to 755 and 0644 The temp folder is in the rootfolder of this subdomain. if ($handle = fopen( 'temp/mylog.log'"a+") ) { if( !fwrite( $handle, $json ) ) {...

What is an ORM in a web application ?

I recently got a reply from a server company asking if we are using an ORM in our application which does all the work of sifting application side (like Rails) or if we write reams of SQL, embedded functions etc which would make the database server do the processing for you. Can anyone explain what is meant by this. Our web application ...

database/algorithm for a rate structure

I have to calculate a price based on a rate structure along these lines: $303.00 fixed price up to 500 units $0.023 additional per unit from 501-10,000 units $0.022 additional per unit from 10,001-25,000 units $0.021 additional per unit from 25,001-50,000 units I'm a little lost on setting up a database structure and algorithm (the la...

Pagination using multiple searcing criteria in codeigniter

Hi ..., Im trying to implement pagination using multiple searching criteria. Supposed I Have student table. I also use pagination when the list of student displayed. The pagination link is. site_url . '/student/page/'; so I use $config['uri_segment'] = 1; so the pagination link will be <a href="http://mysite/index.php/student/page/0"&gt...

SOAP url in browser

When you enter soap servers url in browser, normally it produces blank page. But if memory serves me I saw somewhere something like Hello, this is our soap service. For documentation please follow this link. To get an account, please follow this link. Blahblah. How can I do that? (Using PHP SoapServer, if that matters). I di...

Regex - Matching Abbreviations of a Word

I was thinking in providing the following regex as an answer to this question, but I can't seem to write the regular expression I was looking for: w?o?r?d?p?r?e?s?s? This should match a ordered abbreviation of the word wordpress, but it can also match nothing at all. How can I modify the above regex in order for it to match at least ...

403 Forbidden: The server understood the request....

Building an actionscript Twitter client and using OAuth for the sign in process. Having an extremely frustrating issue with the following error message. '403 Forbidden: The server understood the request, but is refusing to fulfill it.' The following 2 steps ALWAYS work after I click my 'Sign In with Twitter' button, I make it to the T...

PHP 5.3 How to autoload constants?

Hey all. I was hoping that if I were to define constants in a separate namespace, like: <?php namespace config\database\mysql; const HOST = 'localhost'; const USER = 'testusr'; const PASSWORD = 'testpwd'; const NAME = 'testdb'; ?> That I would be able to use __autoload to automatically include them: <?php function __autoload($clas...

PHP SoapClient Warning: SoapClient::SoapClient(): Unable to set private key file

I'm trying to use soap to call a webservice but I keep getting the following error "Warning: SoapClient::SoapClient(): Unable to set private key file". I'm assuming that the error comes due to the fact the the .cer file I am using only includes public key and no private key. But i'm not sure of another way to use the .cer file. If i d...

Creating Variable Variables from MySQL Values

Is it possible to create a dynamic variable in PHP based on the value that comes from mysql database? I mean, say I have a field in mysql State When I read the value in php using row['State'] from the database and if I get a value like Alabama, I want to have a variable created like $Alabama_count and I will initialize to 0 or 1. Tha...

How to get instance of a specific class in PHP?

I need to check if there exists an instance of class_A ,and if there does exist, get that instance. How to do it in PHP? As always,I think an simple example is best. Now my problem has become: $ins = new class_A(); How to storing the instance in a static member variable of class_A when instantiating? It'll be better if the instanc...

How to assert link href value using Zend_Test without an DOMXPath error

Hi, What is the best way to verify that a link with a specific url and content exists on a tested page? I'm using Zend_Test and the following simplified example works fine until there is a dot (".") in the url, which obviously can happen very often... This is OK: $this->assertQueryContentContains('a[href="/index"]', 'Home'); Now if...

Getting contents of square brackets, avoiding nested brackets

(first time poster, long time visitor via Google) I'm trying to extract the contents of some square brackets, however i'm having a spot of bother. I've got it working for round brackets as seen below, but I can't see how it should be modified to work for square brackets. I would have thought replacing the round for square and vice versa...

Convert HTML to RTF (HTML2RTF converter)

I'm looking for a simple HTML2RTF converter that I can use on my website which is using a *nix like Operating System. I haven't found anything on the internet, and was hoping the SO community would help me. PS: I don't want to implement this from scratch, and it doesn't really matter what language it's in, as long as I can run it on a *...

How to get name of calling function/method in PHP?

I am aware of function debug_backtrace, but I am looking for some ready to use implementation of function like GetCallingMethodName()? It would be perfect if it gave method's class too (if it is indeed a method). I hope it (not doing it myself) want be taken as normal laziness, but as good programming laziness. EDIT: Here is the answer...

mssql_query doesn't return anything

I am having problems with setting up a system. We have a SQL Server 2005 running and I want to connect it from another windows machine running php 5.2 and apache. I can connect to SQL using mssql_connect but I can not retrieve any results from a simple query (SELECT * FROM USERS) mssql_query doesnt return anything nor dies or shows an ...

Dynamic Treeview PHP

Hello, I want to make a dynamic populated treeview from mysql database in PHP. I have searched a lot for that, but i haven't got the solution yet (jquery treeview seems not working in my context). And i want to realize is that i extend the treeview by clicking the "+" sign. When i click the item of the treeview, it will execute a que...

Zend: How can I globally set the current navigation item?

config: resources.frontController.plugins.nav = "WD_Controller_Plugin_Nav" bootstrap: protected function _initAutoloader() { $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('WD_'); return $loader; } protected function _initNav() { $this->bootstrap('layout'); $layout = $this->getResource('layout'); $...