php

Check already made query for distinct field values but without making other query

Hi all, I am trying to make menu with multiple submenus.I need to make query that takes the result of preceding query and leaves only distinct results of some field.If i make new query each time the server bugs because the query searches through veri big database. So in short something like that :select distinct(field) form(already made...

Get timezone offset in PHP given a unix timestamp

I have a Unix timestamp that comes from a database that is (unfortunately) in a timezone with a certain of either +3600 or +7200, depending on if it's DST or not. This has never been a problem before, but our website is currently moving to a more international audience and because of Javascript interaction with said timestamps, I need to...

Get WordPress Post ID from Post title

Hi all, I have an issue with a custom WordPress theme I'm developing. It's a bit convoluted, but essentially, what I need to do is get a Post Id by it's Post Title. In pseudo-code it would ideally be something like: title = "foo"; post_id = get_post_id_where_title_is(title); The title mentioned is a static reference not being pulled ...

how can i select particular checkbox within datagrid itemrenderer in flex ?

I have button like random click ,if i click this button then will select 15 checkbox within datagrid itemrenderer checkbox But i can't access the checkbox ? please refer me ? How can access the checkbox ? <mx:DataGridColumn headerText="1" rendererIsEditor="true" editorDataField="selected"> <mx:itemRenderer> <mx:Component> <mx...

Zend Framework Zend Zend_Form_SubForm Label

Hello Been looking for a while on how to sort this out. Essentially, I just need to set a label for a Zend Framework Sub Form. However I try to do this is just doesn't work. Zend Sub Form doesn't have a Label attribute so you can't seem to set it. However, when the form renders, you can clearly see a DT tag inwhich the label should ...

simple template engine help

I've build a simple templating engine for a friend, however i have a problem which i think is a simple one the script looks for these values in a template $find = array("{$body}", "{$page_title}"); and replaces them with some other values. However because they look like php variables I'm getting all sorts of errors and them being un...

mysql_fetch_array, mysql_fetch_assoc, mysql_fetch_object

The functions are all very similar: mysql_fetch_array(), mysql_fetch_assoc(), mysql_fetch_object() I have recently started using mysql_fetch_object as I am doing alot more OOP with PHP. But what are peoples opinions on which one is best to use and why, and maybe which scenario they are best to be used in. Thanks for your thoughts! ...

Getting values from associative array

I have the following main array called $m Array ( [0] => Array ( [home] => Home ) [1] => Array ( [contact_us] => Contact Us ) [2] => Array ( [about_us] => About Us ) [3] => Array ( [feedback_form] => Feedback Form ...

PHP Ajax Caching for IE7 and iE8

I have an application written in PHP/Javascript which uses AJAX extensively. I am concerned that the default caching behaviour for IE7 and IE8 set for our organisation, of 'Automatic' will scupper my application. There are approximately 1500 users and my IT department say that they won't change the caching option in IE for all those us...

Check whether user is logged in or not

I am doing a web-application using PHP for job searching. I have one query; when user is not logged in and wants to apply for the job given by clicking 'apply' button, he redirects to the login page. If the user is logged in when clicking, he should get directly to the application page. I'm not sure how to implement this. I'm confused ...

Recently viewed pages script

Hi, I have a script that shows the current URL: <? function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER...

Zend Framework Cardinality violation: 1241 Operand should contain 1 column(s)

Hi guys, I have a sql problem and i don't know how to fix it, I have tried a few things but..you know.So here is my query: /** * Returns a list with all the months for the archive * * @return array */ public function Archive() { $q = "SELECT DISTINCT MONTH(`data`) AS `month`,YEAR(`data`) AS `year` FROM `posts` ORDER BY `data` D...

two login page(employee & employer),Page cant authenticate user(either he is employee Or Employer)

hello , I'm doing web-application for job seeker & i used two login pages one for employee & 2nd for employer, when I give restrict access to jobposed.php page (which is opened only for employer who is loged in)But the problem is employee who is log in can also open this jobposted.php.But what I have to do this page restriction apply for...

Maximum time limit Error in php

Hi Friends, i develop a webpage in PHP , in that i call a webservice [DotNet] . That service accept two parameters and store the details of the page in to database[For each user the data's deleted].For each user i need to store data . while i use while loop , it shows "".Fatal error: Maximum execution time of 100 seconds exceede...

Is there any API to get Train details of US Railway Service

Hi all Is there any API to get Train details of US Railway Service Thanks in advance Fero ...

How to match and replace in a mouthful with PHP?

Something like this,but I don't want to do it 2 times: preg_match_all($pattern,$string,$matches); $string = preg_replace($pattern,'',$string); ...

Problems Parsing JSON from PHP

Hello all, I get a response form my server via AJAX with an array that is json_encode (php funciton). However, I am having difficulty parsing it. I can do this: alert(response); But it just gives me a bunch of text like so: [{"user_id":"Dev_V2_MEH_0910_M03_v03c_NEW_CODE_03"......"grouper_opae_algorithm":"nap_v42lp"}] Please note, ...

Is there any table changes tracking tool for mysql which will log all changes into other table?

Hi, I am working on a Project management system on PHP (CodeIgniter framework), Mysql, AJAX, XAMPP, JQUERY. I need a customizable table changes tracking tool which will log all changes into another table in same database for mysql. Basically I need to have a table which will have log details of updates, inserts and deletes on a database...

php best practices enforcement

I try to ensure that the code I write is of the best quality possible, so I strive to follow accepted sets of best practices. In perl, I try to follow the guidelines in the popular book "Perl Best Practices" and I use the perlcritic module to enforce the policies recommended in that book. Perlcritic checks my code to ensure that each re...

Web page finished loading before all images are completed

Hi, After the release of the new web site I've developed I have a strange case with the images on the site. It seems like the page is finished loading before all images are completed. The images is located on another server using samba to share the images. Could this connection be to slow? On my development server this worked out all...