php

When would you throw a DomainException in PHP?

I was going through the list of predefined Exceptions in PHP and I noticed the DomainException. Anyone know what does DomainException mean? Does it mean failed data model validation? ...

How to integrate Mercurial with PHPed IDE ?

Hello Can anyone post the steps for integrating mercurial to phped. I followed the following steps, listed by one member on their forum: What to do: Creating a Commit Shortcut * Install Mercurial if you have not already. I've installed mine to c:\development\Mercurial\ * Go to PHPEd Settings > Tools > Integration * Creat...

Jquery Ajax and php classes

I'm trying to learn how to use oop in php. I'm also fairly new to jquery. Is it possible to make an Ajax request to a php class method? I've only ever sent Ajax requests to a file specifically for that purpose and that returns the data I need. Sorry if I haven't explained myself very well. ...

PHP function for swapping array indexes and values

Is there a function which makes $array['blue']='Color'; to $array['Color']=blue' And also, is there a limit on what characters can go inside an array index? ...

How do I turn a PHP array into $keys and $values?

If I have an array as $keys => $values, how can I get two arrays of $keys and $values? ...

Codeigniter route help

I need a codeigniter route so all of the following urls: admin/users/page/:num admin/accounts/page/:num members/results/page/:num products/page/:num are forwarded to admin/users/index admin/accounts/index members/results/index products/index respectively. I'd like just one regexp which could do the trick rather than me setting the ...

What is the best way to load test a web application running on an IIS 6 server?

I am wanting to load test a web based application that we are hosting on an IIS server (Windows 2003, IIS 6, PHP 5.2.0, MySQL 5.0.22). What are the best tools for : a) load testing b) catching bottlenecks c) catching memory leaks anything else I should be looking for? thanks ------------------------------ UPDATE ---------------------...

Want to find out total number of results returning from mysql.

I want to know how many results have been fetched from mysql through my query... ...

Efficiency of web proxy scripts vs. http proxy?

I was wondering which class would be more efficient: PHP (Glype, PHProxy), CGI (CGIProxy), or javascript based scripts that run on a webserver, or an http proxy run through squid. Assuming neither class was doing any caching, would one or the other be much more efficient at handling web browsing? And how could I write a simple script to...

Recursively build XML from PSQL Result Set (using PHP)

Hey everyone, I am building an XML document successfully with the following code: public function build($result) { $root = $this->append(new xmlElement('data')); $root->append(new xmlElement('collection')); while($row = pg_fetch_assoc($result)){ foreach($row as $fieldname => $fieldvalue){ $second = $roo...

ArrayCollection in PHP

How can i return my output in ArrayCollection? values = array(); while($row = mysql_fetch_array($result)) { $values[] = array(mysql_num_rows($result),$row['userlevel'],$row['email'],$row['member_id']); } return $values; I need the output as ArrayCollection ...

PHP Temporarily Banning An IP

Hey guys :) I'm creating a contact form for my company and I want to make it as spam-proof as possible. I've created a honey pot + session checking, but I also want to make it so that it's only possible to submit the form once every x minutes. In other words, banning the IP from using the form for x amount of time. What is the best sol...

Run (remote) php script from (local) python script

How do I make python (local) run php script on a remote server? I don't want to process its output with python script or anything, just execute it and meanwhile quit python (while php script will be already working and doing its job). edit: What I'm trying to achieve: python script connects to ftp server and uploads php script (I al...

What's wrong with this mysql query?

SELECT app_contracts.*, app_customers.id as customer, app_boards.id as board WHERE app_customers.id=app_contracts.customer_id AND app_boards.id=app_contracts.board_id ORDER BY app_contracts.id DESC Error: Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server ve...

Forwarding POST data

I've got a website that has a form that the user can type in. I want it to be the replacement for a 3rd party website (Autotask) form with the same fields. Normally I'd just have the action in my form go to where the 3rd party's form points and then have all the same id/name values for my own fields, but there are several problems with t...

Adding users to a custom group in MediaWiki

$wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['user']['edit'] = true; //$wgGroupPermissions['Human Resource'] = $wgGroupPermissions['user']; //$wgGroupPermissions['Human Resources']['edit'] = true; $wgGroupPermissions['Human Resource']['edit'] = true; //$wgGroupPermissions['Human Resources']['protect'] = true; // 1.5.0 $w...

How to get first x chars from a string, without cutting off the last word?

I have the following string in a variable. Stack Overflow is as frictionless and painless to use as we could make it. I want to fetch first 28 characters from the above line, so normally if I use substr then it will give me Stack Overflow is as frictio this output but I want output as: Stack Overflow is as... Is there any pre-mad...

Table doesn't respond to second jQuery request

Hi All My PHP script generates a table with rows which can optionally be edited or deleted. There is also a possibility to create a new Row. The PHP is activated through jQuery Events. Now all works well, I can edit delete and create an Item. After each action which makes use of the PHP script the HTML table gets updated. But when I ...

Should you accurately specify column types in MySQL?

When I define columns in MySQL I generally use int, varchar(255), text and the occasional enum for boolean. What are the benifits of accurately specifying column types rather than just leaving them at maximum? For example a password field encoded as MD5 will never exceed 32 characters so is there a tangible performance gain from using ...

php send mail code not working

php $to = "[email protected]"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("pMessage successfully sent!/p"); } else { echo("pMessage delivery failed.../p"); } wrote a basic php sendmail code that but it gives me the following error Warning: mail() [function.mail]: "sendmail_fro...