php

What's the easiest way to add Java servlets to a WAMP configured machine?

I have WAMP installed on my local machine and am looking to serve up charts using jFree's Eastwood charting, which requires me to use servlets. So basically I will insert images with src tags that have URLs pointing to my servlet on the same machine. What's the easiest way to enable servlets on the same machine? Do I need to install a s...

php simplexmlelement get first element in one line

Just trying to figure a shorter way to do this: I'm using simpleXMLElement to parse an xml file and it's aggravating to have to call two lines to process an array when I know what node I want. Current code: $xml = new SimpleXMLElement($data); $r = $xml->xpath('///givexNumber'); $result["cardNum"] = $r[0]; What I would like to do wou...

PHP equivalent of PyQuery or Nokogiri?

Basically, I want to do some HTML screen scraping, but figuring out if it is possible in PHP. In Python, I would use PyQuery. In Ruby, I would use Nokogiri. ...

How to compare filename of uploaded file and string

I use this code to upload image files in xammp server: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 100000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . ...

Sending mail with a Php with a pdf attachment

Hi, I'm trying to send an email from the php mail command. I've been able to what I've tried so far, but can't seem to get it to work with an attachment. I've looked around the web and the best code I've found led me to this: $fileatt_name = 'JuneFlyer.pdf'; $fileatt_type = 'application/pdf'; $fileatt = 'JuneFlyer.pdf'; $file = fopen...

Limelight CDN PHP upload interface code

Does any one out there have any php example code to upload files from a php form to the Limelight CDN? Thanks! Paul ...

Ordering by number of rows?

Alright, so I have a table outputting data from a MySQL table in a while loop. Well one of the columns it outputs isn't stored statically in the table, instead it's the sum of how many times it appears in a different MySQL table. Sorry I'm not sure this is easy to understand. Here's my code: $query="SELECT * FROM list WHERE added='...

Determine an elements position in a variable length grid of elements

I have a grid of a variable number of elements. Say 5 images per row and a variable number of images. I need to determine which column (for lack of a better word) each image is in... i.e. 1, 2, 3, 4 or 5. In this grid, images 1, 6, 12 and 17 would be in column 1 while 4, 9 and 15 would be in column 4. 1 2 3 4 5 6 7 8 9 10 12 ...

Cannot redeclare class error when generating PHPUnit code coverage report

Starting a project with Zend Framework 1.10 and Doctrine 2 (Beta1). I am using namespaces in my own library code. When generating code coverage reports I get a Fatal Error about Redeclaring a class. To provide more info, I've commented out the xdebug_disable() call in my phpunit executable so you can see the function trace (disabled loc...

Complex pattern replacement using PHP preg_replace function ignoring quoted strings

Consider the following string: this is a STRING WHERE some keywords ARE available. 'i need TO format the KEYWORDS from the STRING' In the above string keywords are STRING and WHERE Now i need to get an output as follows: this is a <b>STRING</b> <b>WHERE</b> some keywords ARE available. 'i need TO format the KEYWORDS from the ...

In https:// page the PHP Session not working only in IE7 and IE8

can any one please reply why the php session is not properly working on IE7 and IE8 when the web page is navigated to https secured pags? i have properly used the statement at the begining of my php page ob_start(); session_start(); ...

[ZF] How to use Zend_Db without SQL Queries?

The last time I worked with Zend_Db I recall I used to write SQL Queries manually. I've been searching for some ORM application, but, since I read something like Zend_Db is also capable of doing so, I started to try it, but I can't find neither a good tutorial explain it or a good documentation. I read something lake Gateway pattern and...

Why entered key word is not store in database?

Hey Guys, I had made on form, in which i had one text area. Now i am storing that data of text area to mysql database. Now if i had press enter key word then it not stores in the database. Because i don't get exacted output as what i entered. as example... If i had write like this..... GoodMorningHow are you? then i only get like th...

The best way to convert web-page to pdf image

can any one tell me a simple way to convert web-page screen shot to pdf ...

changing the htaccess file in php

Hi, I want to change the maximum file upload size in my website, for this i'm going to add some code lines in my .htaccess file. i have searched in google and i got the lines of code to add in .htaccess file. But i don't know exactly were to add that lines of code . Below is the lines of code currently in my .htaccess file code below...

Making dynamic images have static filenames

My website currently has various links to a php script that generates the images dynamically. For example, the link may say "img source="/dynamic_images.php?type=pie-chart&color=red" Obviously, this is not great for SEO. I'd like to somehow make the filenames of these links appear to be static, and use a solution (like Mod-Rewrite) t...

Run a code after specific time in php

i need to run a code again and again on server after a fixed time. is it possible do so. iam using php. ...

Cannot create or PHP pages on Aptana

Hello, I installed Aptana, but could not find PHP, any idea on how to get the plugin or install the PHP features. Thanks Jean ...

How does Active Record pattern go a long with a Unit of Work pattern

I'm working on extending a framework currently implementing an Active Record pattern. The implementations provides a store/save method on the ActiveRecord class. I guess much of this implementation would be the responsibility of the unit of work implementation, like figuring out when and what object relations to save and so on? How doe...

problem with logout(php) i am new to the site so still have problem in asking questions

I'm getting a problem here when i try to logout, the session is destroy but i still can go inside to that page and view details without login first by using browser mozilla Back button or history cache! How can i solve that? Anybody help me please... code for logout is members page. ...