php

How do I make PayPal and cURL work together?

THE BACKGROUND DETAILS: I have a custom shopping cart that uses PayPal for payment processing. I have an intermediary page between the cart and PayPal that adds the order to a database and sends confirmation emails. Until now, I had the intermediary page set up to include all the necessary data as hidden form fields and submit the form...

Standard size of uploading image (PHP)

What is standard size to upload an image.When user are uploading a large image to my website upload time error is occurring.I am resizing image at the time of uploading also.I want to modify my code as if large image will go to upload then image upload should not occur. So what is standard size of image to upload on server for any websit...

PHP convert date from a MySQL query

Hi all, I think this is a simple question. We have a MySQL database with a DATE field, the date is stored in US format (2010-06-01). In my PHP page where I'll display the date, I simply want to convert this date into a UK format (01-06-2010). Any help and advice appreciated! Thanks, Homer. ...

Output UTF-16? A little stuck.

I have some UTF-16 encoded characters in their surrogate pair form. I want to output those surrogate pairs as characters on the screen. Does anyone know how this is possible? ...

Node update: getting the old value

I'm updating a node with nodeapi update, but there's more that I need to do behind the scenes which requires me to know the old value of a field/ Is there a way I could get the old value of a field before it's overwritten. ...

strtotime("-5 hours") not working?

I thought strtotime() would convert a "string" into a timestamp. If I add on to the time, it works fine, but if I try to subtract, it doesn't. Does anyone know a workaround? Thanks in advance. ...

How do you write a Wordpress function to put a Span around the first word of the Title?

I want to replace first word in title to have <span></span> inside. Example for Wordpress title <h2 class="entry-title"><a href="#">Welcome to Wordpress</a></h2> I want to be like this <h2 class="entry-title"><a href="#"><span>Welcome</span> to Wordpress</a></h2> the function function span_on_title($span) { return preg_replace('...

if block inside echo statement?

I suspect it's not allowable because I am getting "Parse error: syntax error, unexpected T_IF in..." error. But I couldn't find a way to accomplish my goal. Here's my code: <?php $countries = $myaddress->get_countries(); foreach($countries as $value){ echo '<option value="'.$value.'"'.if($value=='United States') echo 'select...

FirePHP doesn't always write log messages

I set my loggers up in my Bootstrap.php like so: $logger = new Zend_Log(); if($environment->debug == '1') { $stream = @fopen('/var/www/html/rta/rta.log','a',false); if(!$stream){ throw new Exception('Failed to open log stream'); } $writer = new Zend_Log_Writer_Stream($stream); $logger->addWriter(...

Accesing XAMPP MySql Database from Another Computer

Hi, So a friend of mine and I are using both xampp on ubuntu, if that helps, to connect between each other's website, We both created the same php file to connect, so we use de IP of the other, but then it says an error Warning: mysql_connect() [function.mysql-connect]: Host 'coke-laptop.local' is not allowed to connect to this MySQL ...

Zend Framwork - Optional Router Labels

Very likely I'm going about this in the wrong way entirely. I'm completely new to the framework.. The site I am developing has two "parts" that are mainly separate. An informational/community half, and a commerce half. I'm using the following directory structure: --application ----default ------controllers ------layouts ------models --...

php simple_xml xpath issue for gpx file

I try to get the lat and lon's from a gpx file (GPS XML). When I do (snippet): $res = $xml->xpath('//*'); I get the full content returned. When I try to narrow down like this: $res = $xml->xpath('//rte'); I get nothing: array(0) { }. Even when the tag(s) exists. Actually whatever I try to fill in after // other then * it returns...

Track redirection links

Is it possible to track which links redirected to my site? For example if it's a short URL http://alturl.com/6rp7w that redirects to http://www.mysite.com would I be able to track http://alturl.com/6rp7w? ...

PHPMailer question

I am getting the error Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: ' etc. etc. etc. and it is a real eye sore on the page. So I want to capture the error or suppress it or something - and then have it be returned to the form so the user can be told there is an error and to re-input their email add...

Can't connect to database using my recently added user in MySQL

I'm trying to add a new user to a mysql database. The original state of the file looks like this (which works): $dconex=mysql_connect("200.xxx.xxx.xxx","abong1","XXXXXX"); mysql_select_db("abong1",$dconex); I'm trying to add this line in between the mysql_select_db: $dconex=mysql_connect("200.xxx.xxx.xxx","abong1_abongler","XXXXXXXX"...

Print the keys of an array

I could not figure out how to pass a variable number of variables into a function. I thought passing in an array and using the array keys for the variables names could replace the need to pass extra variables into the function, and it worked (I'm sure there is a better way to accomplish this, suggestions welcome). However, I can't seem t...

Each array value gets stored into database | PHP

How can I get this array to have a row per value, e.g. array('item1', 'item2', 'item3', 'item4'); I want them to be stored a row each seperately, not into one row. ...

Getting unique values from 2 arrays

I have 2 arrays that I'm trying to get the unique values only from them. So I'm not just trying to remove duplicates, I'm actually trying to remove both duplicates. So if I'm getting the 2 arrays like this: $array1 = array(); $array2 = array(); foreach($values1 as $value1){ //output: $array1 = 10, 15, 20, 25; $array1[] = $value1; ...

Showing timezone specific dates in views with Zend_Date

I'm storing all my dates in ISO-format, so all of them look like this: 2010-08-17T12:47:59+00:00 Now, when my application starts, I register the timezone the current user resides in. In my case, this would be "Europe/Berlin": date_default_timezone_set("Europe/Berlin"); However, when Zend_Date parses ISO dates, it overrides the defa...

query mysql: Select from timestamp

I want to SELECT all the rows from the table that correspond to a specific date. I have the timestamp stored in the pattern 2010-08-18 04:43:00. How can I query the table if I want to select all the rows that fall within a day's time? One way I can think of is get the day's timestamp, convert it into Unix timestamp and then query the t...