php

PHP - header("Location:") inside a function redirects without calling function

I'm using a function called headerLocation() in order to redirect properly. This is the pertinent part of the function, I'm using it to redirect and then display an appropriate message (personal preference). function headerLocation($location,$message) { $_SESSION['output'] = $message; header("Location: ". $location); } The pro...

Access field in a many-to-many intermediate table with DQL in Doctrine

i have a model called ContentGroup and another called Content with a many-to-many relation between them. The intermediate table has a field called Position, When i try to write a DQL query to obtain all the contents associated with a ContentGroup i cannot reference the position field usign the aliases of the models or relations involved...

Autotest equivalent for PHP?

I have been using autotest for unit testing in ruby. Is there an equivalent for PHP that will run my unit tests after my code has been updated? I am using PHPUnit and Eclipse. ...

Using a DAO within another DAO - good or bad practice?

This might be something very trivial, but I am a novice with some Object-Oriented patterns. Put simply, is it a bad practice to use methods from one DAO in another DAO? I am trying to create an entity within a DAO and find it very hard to create that entity using just that DAO. So, is it ok to use other DAO methods within the other DAO?...

jQuery worked yesterday. Not anymore...

Yeah, so I have NO CLUE what happened. I've been writing an AJAX comment script and I got it working, except it doesn't work anymore. I restored it from a backup just in case I chaged anything, but no luck. It goes to the "action" of the form instead of the jQuery, even though I have return false; This leads me to believe that one of the...

Help getting NSURLConnection progress

The app is downloading a file (plist) which is generated by the server. The server takes a loooong time to generate the file, so I would like to be able to show progress (probably view UIProgressView, but that's not important). Since the file I'm downloading hasn't been created yet at the beginning of the request, we don't know the expe...

Thousands of TIME_WAIT despite SO_LINGER, shutdown etc

I'm working on a site that connects to many URLs at once, (we are hoping to get to ~600 per minute) and no matter what I try, there are always thousands of TIME_WAIT still open. I understand these are vital to TCP connections, but they are using all the available ports. PHP doesn't have a SO_REUSEPORT, and SO_REUSEADDR doesn't work with ...

Automatic documentation from PHP code.

OK I know there's PhpDocumentor for generating documentation from php code. It seems it hasnt been updated in a long time (but maybe they figure its mostly feature complete). While this might be good for documenting things for other programmers, it doesn't seem well suited for documenting the external "API" of a web service. IE, if I'...

Occasional MySQL query Error in PHP

I have a php file that has to be loaded as a web page. This page is 17Kb in size. It has a php mysql query script inside. the problem now, sometimes my mysql_query() lines gives an error. When being refreshed, it works again. It just have an error sometimes on that same line. I check the query string and it was okay, for if that was the...

PHP troubleshooting unexpected T_PUBLIC error

PHP is driving me insane right now, please help me, I must be missing something. In this VERY BASIC example below I get this error... Parse error:syntax error, unexpected T_PUBLIC in C:\filename here on line 12 On this line.... public static function getInstance(){ The code... <?PHP class Session{ private static $instance; ...

PHP Memory Optimization

I am using xdebug to trace some code to see how much memory it is using, but at the start of the trace, it is using around 560224 bytes of memory. Is this normal? This is before any code is executed. Edit: I should have clarified; this is not what I am trying to optimize. I just noticed it and wanted an explanation. ...

inserting and updating constantly. is it better to have one huge table or 2 smaller tables

these tables will be constantly inserted new rows or updating. i have a big table containing, video url, title, description, tags, views, rating, comments should i divide this to 2 smaller tables id video url, title, description and link this to above. id video_id, tags, views, rating, comments ...

select items from mysql

making a simple movie review site to practice PHP. on one page ( a form) i write a title and review and submit, it then adds the info to mysql. i'm trying to create a page where i can delete reviews i've written. i'm going about this by returning all titles into a form tag, where i can select on and then submit that form to a process pa...

User/Subscriber sql query

I'm creating a table that shows all the registered users to which the current user has not yet subscribed to. But once he has subscribed someone, I need to filter that list to exclude those. Let's say the theres a table called subscribed which lists the User and to whom he is subscribed to. |UserId||SubscriberID| Its easy to make it...

Sending only populate fields with PHP mail()

I'm finishing up an online menu for a fine dining client. For each item, the user can enter the desired quantity. When the user finishes selecting and submits the form, I want a confirmation email to go to the user and to the restaurant owner (the same message). In the confirmation email, I only want to display items for which they'v...

How many deep can PHP include go

Is there a limit to the number of included files deep you can go with PHP? For example: file1.php includes file2.php which includes file3.php which includes file4.php and so on... I looked in the php.ini file and did not see anything about it. However, for some reason file3.php is not being included. I have checked the syntax to mak...

using curl instead of stream_socket_client

Im working with the apple push notification service, and i notice that some php apns code i found is using stream_socket_client. My host doesnt support this, but it does support curl. Ive read that curl can do SSL connections like the code uses, but im wondering if [a] anyone has experience in doing specifically this, and [b] the intersw...

Google check out - sending email

hi I have a Php project. in this i am using google check out. I have created merchant account and implemented it. It's working well. But i also want to send cart information to another mail id. Is it possible ?? Please help me immediately.. ...

PHP web app + web site same database but 2 users kinds

Im writting a RH system witch consist in two "services": Web App - For RH recruiting management companies Web site - For people and companies to seek/register CV The two things use the same databases for all data... my question is about the users... im the WebApp, the user HAVE to be attached in a Company (my clients).. .but in the w...

Role of Session in user authentication/login?

I was hoping someone could help me with a question I've come up on. I have a Session object that handles storage of general session data, I also have a Authentication object which validates a users credentials. Initially I passed the desired Authentication class name to my Session object then had a login method that created an instance...