php

Comparing form fields with data base fields and highlighting the form fields

Hi, Can you help me in the following two scenarios (PHP+MYSQL) Scenario1: I need to compare the HTML Form field values with the Database field values and highlight the form fields in some color whose values are different from database values before submitting the form (to alert the user). Scenario2: On loading the form, i need to co...

Why self::function() and $self->variable or self::$variable even though there is $this->function() and $this->variable (PHP)?

I'm confused about these two keywords and the way to use them in PHP5. I think that "this" is used for instanced objects (not static) while "self" is referring to the object itself, not an instance of it and thus used within static objects. Right? Now, I believe that the correct use inside a class's static method to call another static ...

PHP recursive function + array by reference = headache

I have an interesting problem. The basis of the problem is that my last iteration of an array reference doesn't seem to "stick," if you will. A little context: I've devised a very simple data structure for page heirarchy that looks like this: ,1,2,3>,4>,5,6,7<<,8 Translation: forget about the annoying leading commas. Pages 1, 2, 3, & 8...

Decision Tree - Must be a better way...?

Hi, Below is my way, albeit a basic way of creating a Decision Tree...The problem is the CSS is getting way out of control and the code is just awful...is there a better way? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/...

Is it possible to reload a form after an input type="file" changes?

Is it possible to reload a form after 'file-input' change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it is possible to reload a form OnChange of the file-input and then call the php code which uploads the picture, so that the user can preview ...

How to Transform a String from Multi-Line to Single-Line in PHP?

Is there a PHP string function that transforms a multi-line string into a single-line string? I'm getting some data back from an API that contains multiple lines. For example: <p>Some Data</p> <p>Some more Data</p> <p>Even More Data</p> I assign that data to a variable, then echo the variable as part/"cell" of a CSV document. It's...

Based on construct create or delete some methods

hi, Based on constructor of the class. create or destroy new methods. I often requires based on construct to disable or destroy methods within the class. Can any one help me out? class Test { function __construct(userID) { if(!isValidUser($userID)) { destroy(methods); } } function addPost() { } } Once destro...

PHP Creating an atom feed

How do I go about creating an atom feed in PHP? ...

Best practice of big javascript objects

Hi all, sry for this imprecise topic name. I am querying a dataset a lot of times so using ajax request would end up in tons of http requests. For this reason I decided to use the json encode method to store this particular data set in my javascript code. My php code looks like this: (no json.parse) echo 'var myDataset = ' . json...

jConfirm with this existing code [Solved]

Hi, I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } If I just change confirm to jConfirm this not enough to make it work... Thanks for your help Lena ...

Connect to slicehost from MediaTemple with a PHP Script (GS Hosting)

Hi, I want use a Redis server with a PHP Site hosted on a MediaTemple GS hosting. MT allows PHP Sockets to contact an external server (slicehost)? ...

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 [cat_title] => Drawings [sec_title] => Portfolio ) [1] => Array ( [title] => title 2 ...

image changed but appears the same in browser...

Hi All, I'm writing a php script to crop an image. The script overwrites the 'old' image with the 'new' one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. If i check my hard disk (i'm working on local machine) i can see that the image HAS changed, but the HTML doesn't pick it up. Mayb...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don't want to hit the DB for every page view. Currently there are ~45k rows returned by this query. Here are some of the approaches I've considered: Cache the row count and update it every X minutes Limi...

Having problems creating a new project in Zend Studio 7.0.2 (ubuntu 9.10)

Hi, I've just installed Zend Studio 7.0.2 on my Linux-Ubuntu 9.10 system. There were no problems during the installation but when I try to create a new project, the 'New Project' form hangs when I click the 'Finish' button. I can cancel the form but no project is created. I suspect it may be a permissions problem!? I have Zend Studio...

open webim ( Mibew Messenger ) time out, reconnecting

hi, i hope you guys know about webim a.k.a mibew messenger. I know only java, jsp and no idea about php except for some basics. Anyways, i ran this app in my apache2.2 local server. Everything works superb! But if i change my db to a virtual machine and give its address in the config.php (previously i had used localhost), in the visitors...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I have an issue when data has been entered into a CMS component that stores data in MySQL. The MySQL collation is set to UTF8_swedish_ci (I read t...

"Global" variable scope in PHP

I have a section of code like the following: ---- file.php ---- require_once("mylib.php"); function($a,$b) { $r = $_GLOBALS['someGlobal']; echo $r; } ---- mylib.php ---- $_GLOBALS['someGlobal'] = "Random String"; This is a bit trivialized, but is the exact problem I have an I haven't found some related stuff, but noth...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I've found return a 2 dimensional array to access specific rows. I want to be able to return only 1 specific row, kinda like mysql_result... except for entire row instead of 1 cell in a row. I don't want to loop through all the...

Wordpress Content Box not formatting correctly.

Does anyone else have this problem? When I am formatting things in the GUI in wordpress it looks great until I save the changes and view the page. Is this an issue with the style sheet? ...