php

Paypal IPN setup...Ship to Zipcode and auto calculation

Hi I have successfully setup paypal IPN on my site and its working fine. From my paypal account I have set options to ass shipping and tax calculations(only if it's Iowa). But the only issue is, on the paypal checkout page it's asking me to enter the "Ship to Zipcode" manually...if I enter and update only then the net payable is getting...

Export Sigma Ajax Grid's data to XLS, XML and CSV

Hi, I'm using the Sigma Ajax Grid... When I click in the pdf export button, in PHP, I can access $POST['_gt_html'] with the grid content: Array ( [__gt_html] => <style type="text/css"> </style> <table id="grid" class="gt-table" cellspacing="0" cellpadding="0" border="0" ><!-- gt : head start --><tr class="gt-hd-row"><td class="...

How to truncate HTML to certain number of characters?

I have some content (some from an external source, some specially written) that is displayed in a kind of blog format. I want to cut off the text after a certain number of characters, so currently I'm doing this: <?=substr( strip_tags($a['content']), 0, 400 )?> The problem is, this loses all the formatting and I just get one massive b...

Include, require & require_once

Hi there. Today I've tried to include file that returns object. I always use require_once, however now I've noticed weird behavior of it. File main.php $lang = false; $lang->name = "eng"; $lang->author = "Misiur"; $lang->text = "Text is test"; $lang->undefined = "Undefined"; return $lang; File index.php $lang = include('langs/eng/m...

Sample code for facebook application in PHP

I need resources to build my first facebook application. I am only able to find only 'hello world' type of applications. Are there complete app source code which includes publishing the output to friend's news feed? ...

Send XML to php script from flash AS2

I have to send some specific xml to a php script (from flash AS2) that then sends out sms message based on the xml. I have been given the xml by the sms sender and have tested it via their live demo and that works fine. The problem I am having is getting flash to send this XML. The sms sender states that it needs to recieve the xml in t...

XPath and PHP troubleshooting

I get this error: Notice: Trying to get property of non-object in Applies to: echo $result->Data; And this output: Array () Background Informations A function returns a string which contains an XML file. I want to get some data from two tags and deal with them on their own. String Data $data=" <SyncML xmlns='SYNCML:SYNCML1.0'...

Zend not autoloading models

Ok, this is driving me nuts! I have a directory structure as follows: application - modules -- default --- controllers --- models ---- DbTable ---- Cachmapper.php --- views My config file looks like this [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../li...

How to run a PHP file on my computer that is outside the htdocs directory ?

I just installed Apache and PHP on my computer to be able to run PHP files locally. I can run a PHP file if it is located in Apache2.2\htdocs directory. Is that possible to run PHP files outside this directory ? I'm looking to a simple solution, because all I need is to write a small PHP code and try it locally. I would like to be ab...

PHP, reading a folder - listing all items with checkboxes and delete them?

hi guys, i wonder if theres a tutorial out there or you could give me a quick and simple approach how i could do the following task. i have a folder on my server. i want to build a kind of cms where i can easily delete files from a folder. i know how to upload them, i already found a tutorial. i think of simply running through all file...

Best practice to deal with form processing

Hello guys, I was wondering what is the best practice to deal with form processing? In my case I do something like that: if the user hasn't submited the form display the form else if there are form errors display errors display form again else display a success message (and) display the form again My problem is that I'm rep...

Catchable error in php?

I have a really odd error: [04-Jun-2010 15:55:32] PHP Catchable fatal error: Object of class Type could not be converted to string in /home/prettykl/public_html/2010/includes/functions.php on line 140 This is the code and line 140 is the $sql line. if (!empty($type)) { $sql = "SELECT * FROM `types` WHERE `type` = '$t...

PHP Zend XML-RPC - Any way to disable the 'nil' in requests?

I'm using Zend XML-RPC Client library to send XML requests to another non-PHP XML RPC server.(it's a java JBoss install, but I don't have control to change it/patch it/hack it). One request I'm making has a <nil/> element, which is a XML-RPC extension. The XML-RPC server I'm talking to doesn't support that because the request fails with ...

Host my wordpress site locally using the server database

I have set up my wordpress site on my local machine and I would like it to talk to the live mysql database on the server. I accessed the wp-config.php file on my machine and changed the hostname to use the ip address instead of localhost, but it will not work. What do I need to do? ...

include facebook profile feed in website

Hi guys I'm trying to access my facebook profile feed and display the status updates on a website. is there any easy way to do this? I'd like to bypass the authorization process if possible. Thanks ...

PHP - MySQL display highest ID number

What SQL query would I use to display the newest entry? Details: id is the primary field. I have other fields but that are not related to when they were added. ...

PHP/MySQL How to make my comments and replies display correctly?

I'm trying to display my comments and my comments replies on my web page but I can't get the replies to display with the correct comment can some one help correct this problem? And by the way all the if else statements are to display different colors for the commenter or replier if he or she is the page creator or user. Here is the My...

Mysql php class

I wrote a class to create an automated connection with MySQL and create queries. Here's how it looks like: include("constants.php"); class MySQLDB { var $connection; function __construct() { $this->connection = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_...

Redirection using HTACCESS is working fine on the server but not on the Sub Domain

Redirection using HTACCESS is working fine on the server but not on the Sub Domain. I used the following HTACCESS code for the redirection task: Options +FollowSymlinks RewriteEngine On RewriteRule ^user/(.+)$ done.php?info=$1 http://site.com/user/123/USA to http://site.com/done.php?info=123/USA Does any changes needed on the Sub Do...

Display XML in proper formatted way

Is there any way to show XML data in a good and readable format using PHP? I know I can build code to do this, but is there a function that does something similar I can reuse? eg: <animals><animal><name>Lion</name><type>Stay away</type></animal><animal><name>Koala Bear</name><type>Hug</type></animal></animals> Is there some code that...