php

PHP: Coding long-running scripts when servers impose an execution time limit

FastCGI servers, for example, impose an execution time limit on PHP scripts which cannot be altered using set_time_limit() in PHP. IIS does this too I believe. I wrote an import script for a PHP application that works well under mod_php but fails under FastCGI (mod_fcgid) because the script is killed after a certain number of seconds. ...

Which of the two ways should I use to insert tags into mysql?

For each ad, I allow users to choose up to 5 tags. Right now, in my database, I have it like... Posting_id TagID 5 1 5 2 5 3 6 5 6 1 But i was thinking if I should make it like... Posting_id TagID 5 1 2 3 6 5 1 ...

Header already sent error in PHP joomla

hi all, $dbhost = 'localhost'; $dbuser = 'EhpEngineUser'; $dbpass = 'password'; $conn = mysql_pconnect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'joomladb'; mysql_select_db($dbname); // include 'config.php'; // include 'opendb.php'; above code works fine, i...

Content-disposition:inline header won't show images inline?

I'm trying to show an image inline on a page. It is being served by a codeigniter controller. class Asset extends MY_Controller { function index( $folder, $file ) { $asset = "assets/$folder/$file"; if ( !file_exists( $asset ) ) { show_404(); return; } switch ( $folder ) ...

How to translate product name and info in Magento

Hi everybody, Magento provide translation feature, a nice one for e-commerce platform. But it seems to me that the translation is only for the predefined magento keyword, like 'add to cart', 'add to wishlist' etc and not for the product name, info, and description that the user input to the store. Does anybody know how to implement thi...

Disabling Text field with Javascript when value in drop down box is from mysql

Hi I have a simple script in HTML, using a dropdown menu. When the value 1 is selected, the user can write in the text field, if value 2 is selected, it disables the text field. However, i changed the values of the dropdown menu, so that one value was from a mysql table(using PHP) and the other remained 'option value='1''. Yet now neit...

WordPress: Only show posts according to their taxonomy

Hey, I am running WordPress with custom taxonomy, added through functions.php in my theme. I am calling posts of a certain post type in another template in my theme but want to restrict which ones it shows by only showing those posts if their taxonomy value equals the current post name that is calling it. So for example: if I'm on the ...

invalid property id error while passing data in json format

I have a some data in JSON format(which comes from php) to be passed to a javascript function. I'm getting 'invalid property id' error when I try to do this. Error: invalid property id Source File: http://localhost/MathVoyager/index.php/test Line: 1, Column: 15 Source Code: draw_quadratic({ Below is the js function signature(both data...

how to place text or image over another one ?

Hi, I am trying to place something (text/image) on another image. How can I do this in Action script or PHP? My trouble is finding the edges of the base image and position the text or image accordingly. Something like at http://www.zazzle.com/cr/design/pt-mug. Somebody please help me. regards tismon ...

what is output buffering?

can anybody explain me what is output buffering and why one is using it in php? ...

iCalcreator 2.6 event creation sent in an email w/o attachment

G'day everyone, I am currently trying to send meeting invitations to Outlook recipients. After reading several blogs and various literature iCalcreator seems to be the most complete iCalendar PHP class available. And the documentation is just...crazily complete. If creating a iCal .ics file is OK, I can't find a nice way to send it by ...

WordPress Conditional: Only show if current page title is equal to post meta

Hey, I am calling a bunch of posts under a certain post type in WordPress which works but I am trying to add a conditional that will check first if those post's custom meta field (labeled "disc") is equal to the current post's title. Here is what I have but this conditional does not seem to work: <?php $pages = get_posts('numberpos...

How can i Rollback for files/folders corresponding to the changes done?

I am using PHP and Mysql I have PHP script in which I rollback all the data in the database such data all the old value be reset to the database if update is done, and all new value gets deleted if new insert has been done. Now my goal is to perform the same process with files/folders associated with the changes done, I am not able to ...

Array Intersect giving wrong output

Hi, I need to find common elements between two arrays. My code is: $sql="SELECT DISTINCT fk_paytbl_discounts_discountid as discountid from paytbl_discounts_students WHERE fk_vtiger_cf_601='".$categoryid."'"; $discountstudentinfo=$objdb->customQuery($sql,false); $sql1="SELECT DISTINCT fk_paytbl_discounts_discountid as discountid from p...

grabbing the value of a text field and applying it elsewhere automatically

if i have a text field like this: <input type="text" name="quantity" id="txtquantity"> what i am trying to figure out is how can i grab the value of that text field and append it to a link like this: index.php?quantity=(the value) if this is done with jquery how would i do it? ...

php multidimensional array problem

Hi to all, i am trying to setup a multidimensional array but my problem is that i can not get the right order from incoming data. Explain $x[1][11]=11; $x[1]=1; var_dump($x); In the above code i get only x[1]. To right would be $x[1]=1; $x[1][11]=11; var_dump($x); But in my case i can dot ensure that x[1] will come first, and ...

How do i track the visitor's country and redirect them to appropriate sites?

HI I want to track the country of the visitors and then redirect them to appropriate subdomains of my site like what google does... And upto what extent i can rely on the data of the api if i should use any?.. I'm using php.. ...

PHP Extension (memcache|memcached) not showing in phpinfo() but showing in php -m and php -i?

I am getting both modules listed as installed / configured when I use: php -m or if I use: php -i but when I use: $m = new Memcache; // or $m = new Memcache(); // or $m = new Memcached(); //or $m = new Memcached; I get the following error: Fatal error: Class 'Memcached' not found I am running on a Mac - OS X (10.5.7) with de...

Is there a way define a global variable which is accesible from a class method?

Here is the situation I create a instance of a class $newobj = new classname1; Then I have another class writtern below and I want to this class to access the object above class newclass { public function test() { echo $newobj->display(); } } It is not allowed, is there a way define a variable globally through a clas...

PHP - How can I check if the current date/time is past a set date/time ?

I'm trying to write a script that will check if the current date/time is past the 05/15/2010 at 4PM How can I use PHP's date() function to perform this check? I can't think of a neat way to do it >.< ...