php

Getting the difference between two time/dates using php?

I am wanting to find out the time difference in minutes between two dates which is in the format d-m-Y H:i (14-04-2009 12:15) using php? ...

Learning JSON in relation to php

Anyone knows where i can get good introduction info on json in relation to php ...

PHPMailer AddAddress()

ok, i don't know how the data should be formatted for AddAddress PHPMailer function; i need the email to be sent to multiple recipients so i tried $to = "[email protected],[email protected],[email protected]"; $obj->AddAddress($to); but with no success. any help will be appreciated. thanks ...

EASY PHP question?

HI Guys, I have following problem. I'm trying to connect from my Iphone app to a php site, to access the mySql db, to get the right information. This is my code: <?php mysql_connect ("localhost", "user", "pass") or die (mysql_error()); echo "Connected to MySql <br /><hr />"; mysql_select_db ("database_com") or die (m...

PHP how to explode string into groups of 6 letters in array

$string = 'billiejeanisnotmylover'; $array = some_function($string,6); $array[0] = 'billie' $array[1] = 'jeanis' $array[2] = 'notmyl' $array[3] = 'over' do you have an idea what some_function would be? ...

PHP Multiple digits regular expression

I need to extract the digits from the following string using regular expression: pc 32444 xbox 43567 so my array will be array ([0] => 32444 [1] => 43567) Can someone help construct a preg_match for me? Thanks! ...

[PHP] Finding last entry in a foreach() process

Simple one guys. I have an XML parsed using simplexml_load_file(). The following code: <?php foreach($xml->actors->actor as $actors) { echo $actors.", "; } ?> Gives the following result: John Smith, Amy Adams, Charlie Doe, How do I modify the code such that it gives: John Smith, Amy Adams, Charlie Doe This need...

How to include drupal form elements in a data table

I have a data table which is populated with data unrelated to drupal content (from a third party system). The data relates to photos which must be approved / flagged as inappropriate. So I'm writing a Drupal admin module which should moderate this content. So far, I have built a table using theme('table',...) which shows 1 photo per row...

Explode- sort of?

Using PHP, reading in a string like the following: 36,2,"$21,830.00","$18,012.50","$20,764.00","$14,935.00","$13,655.00","$15,820.00","$6,895.00","$4,357.50","$4,944.00" I want to explode using the comma (,) as a delimiter, but I've realized there's a problem- my money values also have commas! Can anyone suggest a way to handle this? I ...

Filter a string to contain only alnum chars + a hyphen?

Hello, I would like to filter a string and strip all characters that are not alphanumeric or a hyphen. Is there some tunction in PHP for that? Not sure how to do it. ...

Should I use SQLite for automatically build a list of banned IPs of comment spammers?

I am using a simple yet effective anti-spam system at a comments module which seems to be working flawlessly for more than a year now. Since it is capable of recognizing automated comment spam attempts, I am thinking of extending this security module with an ability of adding the offender IPs to a blacklist automatically. Do you think ...

User configurable forms with php and mysql

An online application we are building (php & mysql) requires users to be able to create their own forms for data capture and record this data in a database, respecting the existing ORM's. If the forms where "hard coded" then we would simply set the db tables up to store the normalised data ourselves however as our users define the form ...

Getting an excerpt from HTML in PHP

I need to get a short excerpt of news items written in HTML to show on my front page. Obviously I can't use something as simple as substr because it might leave tags unclosed or even leave half a tag. Which is easier: Converting the HTML to decent looking plain text and take a piece of that Taking the beginning from the HTML and closi...

trouble creating a sql statement select statement reference same table twice

Ok, here is setup. Note the code below is SIMPLIFIED version. PHP 5.2 ENGINE: MyISAM table quotes q table users u FROM quotes q LEFT JOIN users u ON q.qid = u.uid Soo... the quotes table references a user (from users table) (the owner of quote) but quotes table ALSO has a field called createdby (the user who created the quot...

Wille php copy() work for a person viewing the site who has the site which i'm copying from blocked?

Say I use php copy(), to get a file from a site. And then a user who is using a proxy filtering service that has that site blocked, will the site still be able to copy that file for the user? If not, would a cron job be able to? And is the same for file_get_contents? Cheers ...

What characters ARE allowed when querying a mysql database?

I have a textarea in a form, when I enter special characters in it, I get an error in mysql. (when submitting the form to a php-file which does the work of inserting into mysql) I need to know exactly what characters that aren't allowed, or easier would be, exactly what characters thar ARE allowed, so that I could validate the textarea ...

Simple HTML DOM help

How can I extract the value attribute of an input tag? Using SIMPLE HTML DOM let me give you an example: <form action="#" method="post" name="test_form" id="test_form"> Name<input type="text" name="name" value="NaMe"/><br /> Address<input type="text" name="address" value="AdDrEsS"/><br /> <input type="hidden" value="sayantest" /> </fo...

How to make a list of unique items from a column w/ repeats in PHP SQL

Say I have a table that has a column which goes Column B apple apple apple orange apple orange orange grapes grapes mango mango orange And I want to query it in such a way that I get a list like so apple orange grapes mango How do I do this in PHP SQL? Much thanks. ...

Use of double quotes in a 'input type="text"' value wont work, string stops at double-quote !

How can I make it possible for users to use the '"' (double quote) inside a textfield... Whenever I do use double-quote in the field (the value) then when receiving the variable in my PHP file with: $text=mysql_real_escape_string($_POST['subject']); and then echo it, I get a string which is escaped properly, but the string stops e...

Remove Cookies from JS or CSS files

Bizarrely my javascript and css files have cookies (says Firebug). I use Zend Framework and I think it has to do with it. Could I change the .htaccess that CSS or JS files don't link to the ZF or is there another solution? .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] Rewri...