php

Testing multiple classes with PHPUnit

This might be a stupid question, but I can't seem to make it to work. I'm using PHPUnit to test. Currently I have two classes in a file called Tests.php: class XTest extends PHPUnit_Framework_TestCase {...} class YTest extends PHPUnit_Framework_TestCase {...} However, I'm unable to run both classes. I'm running the following command ...

What Software Management tool do you use?

Hello all, I couldn't decide if this question fitted here or superuser. I guess it can be moved if not appropriate. I am developing a new piece of software with somebody else and we are half way now. However, the changes we now make are getting messy as we do not know what changes have been made. So I wanted to know what you guys use t...

Best way convert text with '&' into the variables

I've got a this text "?foo=bar&foobar=barfoo" what is the best way to convert this text to variable? Like this: <?php echo $q['foo']; //bar echo $q['foobar']; //barfoo ?> Thanks. Sorry for my English. ...

Auto incrementing number in PHP foreach loop

This is the beginning of a php for loop. I would like to edit it so that 'INSERT NUMBER HERE' gets replaced with an incrementing number. Ie. first loop it would be 1, then 2, then 3 etc. <?php foreach ($_productCollection as $_product): ?> <div style="float: left; font-size: 120px;height:50px;padding-top:50px; color:#ccc">INSERT N...

How can I put two queries in one mysql_query?

I'm trying to do something like this: mysql_query(" UPDATE name SET money = money + 1; UPDATE surname SET money = money + 1; "); but it doesn't work. It's just example, but my question is: How can I put two or even more queries in one mysql_query? ...

phpmyadmin using mysqli connects, but my php using mysqli errors out

This is driving me nuts! I am getting the classic "Can't connect to local MySQL server through socket '/var/run/mysql4d/mysql4d.sock' (13)". Everything I've dug up so far tells me my setup should be OK (eg, defining the sockets in php.ini and my.cnf, etc). Worse... phpmyadmin works with the same un/pw I am using in my own php. So o...

Dirty errors with PHP popen()

Hi, I call a file with popen(): $fp = @popen("/usr/bin/openssl ..."); the specific details don't matter, but what happens here is that when I run the command I receive these errors on a Windows CMD: The system cannot find message text for message number 0x3 in the message file for System. I know that the file don't exist on...

XAMPP + Perl + PHP. Not sure how to run Perl script.

This is very stupid but I seem to be completely lost trying to test a Perl command-line application with XAMPP. I downloaded the 'ExifTool by Phil Harvey' and extracted the files in a folder within htdocs with an index.php in it, in which I hope to set up a PHP interface to the functionalities provided by ExifTool. Actually I can't even ...

What is bindtextdomain, textdomain in gettext?

I've been learning a bit of gettext but I can't grasp those two functions. I've been wondering if I could use multiple translations in a APP written in PHP. For an instance, I've 1) the system translation 2) extensions translations 3) theme translations to divide those in different files. My question is, if I load the system translation,...

What type of errors actually happen with mySQL/PHP

Hi - I'm working on a web-based application using mySQL, and I've used it in the past. I've never seen a mySQL error other then something during the development process -- ie. poorly formed selects -- but once its 'working' what kind of errors are there? I've never seen an insert or select fail - can they? If the syntax is correct, why...

facebook connect set status error

When I update status from facebook connect, following error occur Uncaught exception 'FacebookRestClientException' with message 'Updating status requires the extended permission status_update' I also allow permission with <script> FB.Connect.showPermissionDialog("offline_access", function(perms) { if (!perms) { //co...

How to pull all instance variables of an object as local variables into the scope of an method from that object?

I have an class with some instance variables. It's purpose is for templating. So this class has a fetchTemplate() method which includes a PHP template file. In my template file, I can access any variable that has been assigned to the template, by writing: echo $this->theVariable If there was a way to "pull" all arbitrary instance va...

Does Ruby share PHP's multibyte string problem?

PHP has a lot of trouble with multibyte strings (non-ASCII characters). The entire language was built assuming that each character is a byte. To solve this they invented the mb_strings functions which you can use instead of the standard functions (which work fine). strlen($str); mb_strlen($str); // correct However, this is really a pa...

facebook app getting redirected out canvas view

i am using iframe to render my app from my server. the problem is once i click on a link in my app, i am being redirected to my server. i mean, i remain in tha canvas page for a second, then suddenly instead of viewing it in an iframe on the facebook website, i am redirected the app URL on my server. I am using PHP and MySQL. why is th...

Should I use if statement? If yes, what will be good in this PHP case?

When I use function create_category(), it will create a directory with this name such as images/newfolder. Then I have a function edit_category() which checks post('name'). In a controller function edit_category($id=0){ if ($this->input->post('name')){ ... ... I don't want to allow to change the category name. It will create anoth...

OOP design question

I'm relatively new using OOP in PHP. It's helped immensely in the organization and maintenance of my code, but I'd like to get better at designing my classes and using OOP as efficiently as I can. I've read the Gang of Four Design Patterns book, but still need some help. After building a few small apps, here's one thing I keep running ac...

SOAP: PHP WebService and .Net

I have to connect with PHP WebService via SOAP from a .Net (C#, WPF) application. I added reference to this service, some proxies were generated. When I invoked some function: var client = new someAPIPortTypeClient(); XmlNode[] response = client.status(arg1, arg2); I got response: SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http:/...

php header errors in facebook app

i am building a facebook app which is somehow generating these weird errors. the following are the errors I am facing: Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/index.php:2) in /home/amitver/public_html/roadies/facebook.php on line 395 Warning: Cannot modify...

Download files one at a time, not all at once

What I'm trying to do is download a set of images, about 200 of them. Now, I could install some addon or a script to firefox that just lets me download em all with a few clicks, but before I thought of doing that, I was thinking on how I could do this with a few lines of code. Languages I have at my disposal are C#, Java and PHP. I'd pr...

Are PHP closures broken or am I missing something?

I've been reading on the new features of PHP 5.3, and one of the major features are closures. Unless I'm very badly mistaken, the PHP developers are either: a) confusing closures with just anonymous functions b) the closures are broken in PHP 5.3.1 in which I'm testing From what wikipedia says closures are the mechanism of anonymous fu...