php

How do I control script execution time in PHP

for example I do have 5 PHP functions on a page which execute when loading. each functions has its own processing time and some of them take more time sometimes to complete the task. hence the total loading time of the said page is slow. my question is how do I control execution time for each script and set time limit for the same. I am...

How to implement Google OpenID authentication in PHP & Test on Localhost

Hi, I am new to OpenID, and want to implement Google OpenID authentication on my website. I could not found any example. Can anyone suggest me some good tutorials (step by step) or any working example with code to implement Googl OpenID authentication using PHP. All helps are appreciated. Thanks, Navin ...

Not able to pass value from [object HTMLInputElement]

Hi there, I am passing hidden value, and getting it into javascript function. I want to pass this value to another page. Before passing when i print it, it gives me [object HTMLInputElement] $var4 = 1; echo "<input type='hidden' id='var4' value='$var4'>"; and accessing it in javascript var y = document.getElementById('var4');...

How to find an array from parent array

Hi, I am using below code to find an array inside parent array but it is not working that is retuning empty even though the specified key exits in the parent array $cards_parent = $feedData['BetradarLivescoreData']['Sport']['Category']['Tournament']['Match']; $cards = array(); foreach($cards_parent as $key => $card) { if ($key ===...

performance of mysql +php

hi, I am using mysql driven application where in all data comes from mysql and display it using php. when designing the DB what all precautions must be taken so that mysql gives best performance. i had a small doubt . I have text column in my form , and i dono how much length data will be entered . So instead of varchar(255) if i c...

How do I flush the Zend Output buffer at the Controller stage?

I have a Zend Controller that serves files to users I have used Noginn SendFile action helper to do the actual streaming of the file, but the code simply uses readfile($path) to place the content of the file into the buffer after setting the MIME and content type etc The problem is that the file that arrives down the pipe has an extra ...

ASP.NET MVC2 - Isolate subfolder for using PHP

I would like to have domain.com using asp.net mvc2 technology and domain.com/blog would use php. Is it possible to do this on server and to isolate this folder to use php? I know that it is much easier with subdomain (blog.domain.com) but I'm interested in subfolder solution. ...

PHP while array

Hello <?php $airports = array('LED','DME','SVO','VKO','AER','KRR','IKT','KGP','KHV'); if ($content = getData('LED')) { return $content; } Need to go on line through the array until the content is not empty! How? Sry for bad english ...

"boolean and include .." works but "boolean and unset($v)" reports syntax error in PHP?

This works: !function_exists('testfunc') and include("testfunc.php"); This will report syntax error: !function_exists('testfunc') and unset($q); Aren't they the same thing? ...

HTTP Error 408 / 409 - Not acceptable / Resource conflict Internet Explorer

Hi, I've wrote a PHP code, that downloads an excel file when the user clicks a button on the page. The code connects to db and use some stored functions which do some calculating multiple times so the execution time takes so long. I ran the code at localhost several times and everyting went well. But when I tried to run in my web server...

Why can't I view the public folder of Zend Framework Project?

I recently started learning zend framework. I am trying to access the index.php inside the public folder, but when i test the project using WAMP server in browser, I can't find the public folder in the web root. I can see other folders like applications, library, docs but there isn't any public folder. Why can't I view the public folder...

How to copy a Database from one server to another server in PHP?

I have a Database in Local server named 'empData' and i want that all the data from that database to be copied to another Database, which is in the another server(web server) with the name 'empDataBackup'. I have tried this code mysql_query("INSERT INTO empData.backup_emp SELECT * FROM empData.emp"); But it did not work as both the dat...

JQuery Ajax success: function()

I know, silly question but what do I put where? I post data to a php processing page: $insert = mysql_query('INSERT INTO '.$table.' ('.substr($addfields,0,-1).') VALUES ('.substr($addvals,0,-1).')'); a bit like that I want to have if($insert): echo 'Message 1'; else: echo 'message2'; endif; what do I do in my success: function(...

OOP PHP and MySQL

Hi I'm new to OOP with PHP. I'm wondering how OO comes into play when selecting data from a table. i.e. i have a users table and a user profile page. So I have a User class. Do I select the user data from the table then create a new object of class User and define the properties? Thanks for anyone that can clear this up for me! Regards...

Developing a web application using php, please give some suggestions.

I am developing a web application which is using php. It will use the mySQL database for storage. But The application may upgrade in future, so I would like to know is there any framework for me to reduce the pain of upgrading database structure. I know that there is a framework called cakePHP. And the application will deploy in more ser...

Set default context in Zend framework to XML

Hi there! I'm using Zend framework, and most of the action controller that I have return XML response. In order to do this, I have to initialize context switching and provide URL suffix "?format=xml" to call each action. Is there any way to make this default? So I don't have to add this suffix each URL? Regards, Andree. ...

Generation of formatted files with Ruby in the way how it can be done with PHP

Hi, I use PHP to generate files of some special format, and I have decided to try the same thing with Ruby. To make a file with PHP, I use the following code: <? include 'functions_and_settings.php'; ob_start() ?> some parts of another format <? // php functions generating file content, // including other formatted files ?> some ...

Sql syntax error

Here is my query: $query="Delete b Where Exists ( Select 1 From a Where a.poster_password = '$pass' And a.ad_id = '$id' And a.classified_id = b.classified_id ) Delete a Where a.poster_password = '$pass' And a.ad_id = '$id'"; I get this error: "You have an error in your SQL syntax; chec...

Drupal: Programmatically saving imagefield images

Hey there! I'm trying to write a sync function that saves some data to nodes, which works fine, until I try to save the thumbnail image associated with the node. I've managed to download the file and put it in my sites/default/files folder, but what's the best way to tell Drupal, "put this file in that CCK imagefield"? EDIT To clarify...

Heavy Wordpress MySQL query, please help me find it and optimise it

I have a wordpress website up and running that is reasonably popular but over the last couple of days my performance has degraded terribly. I have installed Jet Profiler and have been monitoring the MySQL database to see if I can find something wrong and this one query is consistently the worst offender. SELECT SQL_CALC_FOUND_ROWS wp_...