php

array_combine empty values

Hi, One array is 35 elements (mysql column names) Array ( [1] => ID...) second is only few elements: Array ( [1] => 63 [2] => REF213211 [3] => aaa [7] => Warszawa [8] => Wola [12] => 100 [14] => 1 [15] => 100 [35] => 1 ) I need to combine first array as keys for second array Please help ...

Zend Validate - How do you pass context values from a different subform?

I've split up a Form into 3 SubForms and for one of the elements, in the last SubForm, I am creating a Validator that extends Zend_Validator_Abstract. This validator needs to check that a value, on the second SubForm, is not empty. However this value will not be in the $context array for the element in the Third SubForm. What is a sens...

How to get rows count from table in doctrine

I have wrote universal script to get all rows from Doctrine Table Models, but if rows amount is too large, i get exception: Cannot define NULL as part of query when defining 'offset'. Running script: $table = new JV_Model_StoreOrder(); $this->data['list'] = $table->getTable()->findAll()->toArray(); I understand from the error above...

PHP ADOdb/PDO equivalent of Perl DBI quote_identifier?

At my current job, the standard practice has been to use mysql_query() and friends directly. When constructing large queries, since our standard deployment is on MySQL, table names just get inserted and surrounded by backticks (partial, fake example): $sql .= "from `$tablename`"; I'm trying to get away from MySQL-ism's, and as part o...

Porting PHP5 to legacy PHP4, DOMDocument quibbles

I'm trying to make some of my php5 code work on a legacy server, which unfortunately cannot be upgraded (client's machine). if (!isset($docRoot)) { $docRoot = $_SERVER['DOCUMENT_ROOT']; } // generic storage class for the words/phrases $t = new stdClass(); $t->lang = $curPage->lang; // load xml translations, could split this int...

Getting familiar with XAMPP

Iam not able to get familiar with XAMPP interface on Windows7 (Only prior experiencxe is with HTML,C,C++). How to proceed to begin development work in PHP and MySQL and test developed contents using Apache Server. Please help to understand its working flow. Thanks in Advance. ...

The object oriented relationship...

Hi guys. I was asked to describe the relationship between vehicle, car, toyota in object oriented programming term (let's say in php environment). I was stumped. Can someone help me about it? Thanks... ...

PHP - How to serve the upload image to the user

In my website, the user can upload a profile image. The website structure is as follows: C:\xampp\htdocs C:\xampp\upload\user1 For security reason, the upload file has been moved into folder C:\xampp\upload\user1\. The question is how I can serve this image later to the user. In other words, after uploading the image, the user should...

symfony error handling without form framework

Hi, I'm new to Symfony and struggling to find an elegant solution for handling errors. I know I can throw Exceptions and make my own Exception classes, but it's how to display the error to the user in the best possible fashion. For example, I've got a Card class that charges credit and debit cards, there are a variety of different prob...

nginx "400 Bad Request"

My php script calls an url with curl very simply : $ch = curl_init("http://192.168.0.110:8000/guess/a b c"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $r = curl_exec($ch); With this url, i have no problem. But if change to : $ch = curl_init("http://192.168.0.110:8000/guess/a b cd"); I have a 400 Bad Request nginx/0.7.62 error...

php - destroy all sessions

Possible Duplicate: Is this a proper way to destroy all sessions in php? Hey Guys, what's the best way to destroy all sessions (not just the one of the current user). Thanks in advance! ...

WCMS in PHP or Java (for java developers) ?

Hi everyone, In my company, we're a java developer team. For a project, we need to choose a web content management system (wcms) first. Can we choose a php one ? will we then have to learn php because our customer has some particular demands so we're likely to have to plug our own features... or can we add our plugins in java and find...

How to post two form with single submit click

I had two forms 1.login form 2.Registration form login form has the username and password fields and registration form consists controls for registration like username, city, country, etc., 3. Also, i have some hidden controls like <input type="hidden" name="ctrl1" /> <input type="hidden" name="ctrl2" /> <input type="hidden" name="...

Class instance variables becoming null in php

I have this PHP class, whose purpose is to fetch some configuration data from a database and store it for later use: class GSConfig { private $configurationData; private $repository; public function __construct($pRepository) { $this->repository = $pRepository; $this->configurationData = $this->InitializeConfiguration(); ...

limit visits to site

i need to limit visits to my site from some regions. how can i don't allow to visit my site from some country?(from Armenia for example) (what is the way i must go? .htaccess? or maybe only by ip addresses?) ...

joomla content plugin

How do i get this plugin triggered in the joomla core "user manager" when a list of user is displayed? 1. I have already enabled in the plugins table but it is still not working. What I have not done? // no direct access defined('_JEXEC') or die('Restricted access'); // register the handler $mainframe->registerEvent('onPre...

verify string with preg_match

Hi all, I have question that seems simple to you all but can't really get it. encounter warning till now. May I know how can i accept a string with integers 0-9 and alpha a-zA-Z but minimum 5 characters and maximum 15 characters with preg_match. Thanks ...

PHP: How should I escape a string that will be going into a Javascript String?

How should I escape a string that will be going into a Javascript String? URLEncode(X)? str_replace("'","\'",X)? ...

Quoting and escaping text strings advice

I am mainly C++ programmer who returns to PHP seasonly. Every time I return I spend time to get used to echo/print correct JavaScript/HTML/CSS regarding the single quote and double quote ...etc. I need an advice in the form of a set of rules to follow for good escaping practice. Edit This is a small example for my bad working code tha...

Get additional user details with PHP and mail() function

Hi Everyone, I have a simple PHP script that sends a message to a specified email address with content from a HTML form using the mail() function (which I am aware is prone to spam). I was wondering if it's possible to obtain additional information about the user's settings and input them in the sent mail. Additional information could...