php

Good Zend Framework example apps to learn from

Hi! Do you know of any open-source Zend Framework applications besides Magento that show in a good OOP-way how to develop big apps with Zend Framework? My problem right now is, that I'm pretty good at PHP and OOP, but I don't have enough knowledge of the Zend Framework and how things should be solved in it. So do you know any good app...

I have PHP running on Google App Engine - How do I use DB now?

I followed this to setup PHP on the Google appengine and it works great. Any suggestions on how we can use a database / datastore with this on GAE? ...

"Webpage has expired" $_SESSIONS in PHP

Hi there In my web-application I'm using $_SESSIONS but sometimes, when the users hits the backspace key he gets "Webpage has expired" message. Why is happening this? What to do to avoid this? ...

What is the best class structure for simple php framework ?

I am trying to create simple php framework .But i am not sure about class structure for example which classes should extend to which classes .Firsly i am know that some basic classes such as Router , View classes have to access some basic data such as requested url or requested ccontroller and action so how can i import basic data to the...

Use Cacti to Monitor HTTP Status Codes of Request Responses?

I have a proxy script that makes HTTP GET requests to other pages using cURL through PHP. Is it possible to monitor what response codes are returned to those cURL requests, using Cacti? If not Cacti, possible with any similar monitoring system? For example, I want a report that shows how many responses came in each status category, ie,...

How can PHP determine if user pressed Enter key or Submit button?

The problem I'm having is that I have multiple submit inputs in a single form. Each of these submit inputs has a different value and I would prefer to keep them as submit. Whenever the user presses enter, it is as though the topmost submit input is being pressed, and so it is causing problems for the code checking which input was clicked...

Why can't I pass user sessions between subdomains?

First of all, I have used ALL of the suggested methods in this SO article: http://stackoverflow.com/questions/644920/allow-php-sessions-to-carry-over-to-subdomains For your convenience, here are the tips I already followed: Here are 3 options. Place this in your php.ini: session.cookie_domain = ".example.com" In your ...

In PHP can I get the total number of case statements in a switch statement?

Is there a way to return the total number of (case) instances there are in a switch statement? Something like this: $id = $_GET['id']; switch ($id) { case "item1" : $data = 'something1'; break; case "item2" : $data = 'something2'; break; } echo $data; But the reasoning for it is there are multiple files with these switc...

How to set an Arrays internal pointer to a specific position? PHP/XML

Im trying to build a little site using XML instead of a database. I would like to build a next and prev button which will work relative to the content I have displayed. I found the php function next() and prev() as well as current() but I do not know how to set the pointer to a specific position to be able to navigate relative to the ...

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result

I get the error when trying to run this: <?php require_once('includes/DbConnector.php'); $connector = new DbConnector(); $result = $connector->query('SELECT title,content FROM staff_vacancies ORDER BY ordering LIMIT 0,100'); // Get an array containing the results. // Loop for each item in that array while ($row = $connector->fetchArray(...

Which PHP framework for web application rewrite?

I wish to rewrite a medium web application (70 php scripts). Currently, it makes use of PHP in a procedural way and I am more than sure the code is not efficient, extendable or scalable. My question is, for this scenario, which PHP framework shall I adopt it? I wish to be able to do this rewrite as quickly as possible, performance of t...

Xdebug profiler and xdebug_time_index() give different values

I used Xdebug to profile my PHP application. When I open the generated profile file with WinCacheGrind, it gives me a total cumulative time of 3ms for {main} (0.003s). However, when I use the function xdebug_time_index() at the end of my code, it returns a time of 0.03s. Anyone knows what might cause this difference and which one is ...

PHP Zend Framework Generator

Hi, I am in the phase of learning Zend Framework for PHP development, I have been doing 'dirty' PHP programming for about 2 years now and I have learnt quite a bit from my mistakes. I have been introduced to Ruby On Rails, it is a great framework and Ruby is quite an interesting language too, but not everyone wants their web sites to be...

PHP header redirect not working when posting a form - using output buffer - but does in other cases?!

Hi, I have an unusual problem, only happening on one server. Following code .... elseif ($_GET['action']=='login') { if (empty($_POST['login_name'])) { $_POST['login_name']=''; } if (empty($_POST['login_pass'])) { $_POST['login_pass']=''; } if (!empty($_POST['send'])) { if (($_POST['login_name']==_ADMIN_NAME) and ($_POST['logi...

round number to nearest 0.2 with PHP

I'm creating this rating system using 5-edged stars. And I want the heading to include the average rating. So I've created stars showing 1/5ths. Using "1.2" I'll get a full star and one point on the next star and so on... But I haven't found a good way to round up to the closest .2... I figured I could multiply by 10, then round of, and...

Figure out if I'm nearby something

I've got my current location lat long and I've got a list of places and there lat long. What I'd like to do is figure out if I'm nearby one of the places, nearby would be something like +100m. I don't want to display a map, just know if I'm near it. What kind of php libraries are available for comparing location/lat long? Or can I solv...

Transposing multidimensional arrays in PHP

How would you flip 90 degrees (transpose) a multidimensional array in PHP? For example: // Start with this array $foo = array( 'a' => array( 1 => 'a1', 2 => 'a2', 3 => 'a3' ), 'b' => array( 1 => 'b1', 2 => 'b2', 3 => 'b3' ), 'c' => array( 1 => 'c1', 2 => 'c2',...

mysql count into PHP variable

Hi there, Let say that we have the following query: SELECT DISTINCT COUNT(`users_id`) FROM `users_table`; this query will return the number of the users from a table. I need to pass this value to a PHP variable. I'm using this: $sql_result = mysql_query($the_query_from_above) or die(mysql_error()); if($sql_result) { $nr_of_user...

How to extract a matching phrase from data in MYSQL/PHP ?

I am trying to implement searching functionality in my website. I have following type of data. Title Descr ----- ----- World News World news, news from across the world, all world news events covered World Sports World sports news, for all of sports people, sports is a famous world No...

How to Include Variable inside Class in php

i have some file test.php <?PHP $config_key_security = "test"; ?> and i have some class test5.php include test.php class test1 { function test2 { echo $config_key_security; } } ...