php

Constructing SQL query(ies) with optional parameters/ranking

Hi all, I was wondering what would be a good way to accomplish the following using mysql: Lets say I have a table that contains these fields: MyTable --------- Country [string] Region/Province/State [string] City [string] And I have the following data rows in the database Entry 1: Canada, Ontario, Toronto Entry 2: Canada, Ontario,...

Would like feedback on my PHP programming & advice on sessions

Hey I'm new to PHP so would really like your insight on how I'm programming and also I'm having trouble coming up with a solution for a session problem. I'm making a script for a bartering and Local Trade System (LETS) and I'm currently coding the offer page where the user can view all products/services on offer and then click on a pro...

php function class_exists causes crash in production environment

I'm using the Zend Framework, version 1.10.7 for my application error_reporting(E_ALL); $application->bootstrap(); echo 'ha'; var_dump(class_exists('Default_Model_FeedReader_Csv_HappyHome')); echo 'hoi'; The output the this piece of code is only "ha". Error reporting is on, but there are no errors. The script simp...

google analytics api in php website

Hi, I am creating a custom reporting website, where I want to show live data from google analytics and accordingly the data in my website will change. I want it to be automated and dynamic, like whenever the data changes in GA, i want it to be automatically changed in our website, which will be shown to our clients to show the performanc...

Finding Domain Names from List of URL using MySQL/JAVA/PHP

Hi Friends http://en.wordpress.com/tag/1000-things-we-hate/ http://en.wordpress.com/tag/1019/ http://en.wordpress.com/tag/1030-am/ http://www.yahoo.com/index.html http://www.msn.com/index.html i am having list of domains as above in my DB, i need to get only domain name from this, how can i do that in mysql or in JAVA or in PHP ?? ...

Informal PHP date output library

Hi there, is there a library out there for PHP that formats dates in an informal way? I would love to have outputs like yesterday, 2 minutes ago, just now, three weeks ago – just like in Facebook. Makes blog posts appear so much more human. Thanks in advance for your help. ...

How do I convert unicode codepoints to hexadecimal HTML entities?

I have a data file (an Apple plist, to be exact), that has Unicode codepoints like \U00e8 and \U2019. I need to turn these into valid hexadecimal HTML entities using PHP. What I'm doing right now is a long string of: $fileContents = str_replace("\U00e8", "è", $fileContents); $fileContents = str_replace("\U2019", "’", $fi...

Convert Numbers to Numbers and Letters in PHP

I have the following number 353711000 and I need to convert it to 35371TH in PHP. How would I go about this? ...

Download different files based on URL string for users

Im promoting a website that has a simple "Download Now" button. When a user clicks this button, they receive a file (a firefox addon that installs in their browser). I've created a number of different version of the addon to use with different marketing channels (AdWords, Facebook Ads, Yahoo, etc). Each version has a unique ID that is p...

Best/easiest way to parse configuration parameters in Sh/Bash and php

Hello, I got in every php project (around 25!), some sh scripts that help me with routine tasks such as deployment, repo syncronizing, databases exporting/export, etc. The sh scripts are the same for all the projects I manage, so there must be a configuration file to store diferent parameters that depend on the project: # example conf...

Return a single Element from an Associative Array from a Function

Lets assume we have two PHP-Arrays: $some_array = array('a','b','c','d','e','f'); $another_array = array(101,102,103,104,105,106); In PHP, there are already some Array-Functions that allow the construction of an Associative Array (AKA hash), e,g,; $hash = array_combine( $some_array, $another_array );...

Styling Pagination Links

Hello, The pagination code below works just fine. However, I'm having an issue with the CSS. The location of the pagination links really only display where I want when the user is on page 1. This is 2800 pixels from the top of the browser. For pages 2 through n, there is about 100 extra pixels of space between the bottom of the HT...

PHP - Apache server config DocumentRoot

Recently on my web server I changed the index.php page to 301 to / for SEO purposes. Now that I'm offline and using XAMPP, the document root is set to http://localhost/xampp/ and trying to login is sending the form to / which is the xampp folder rather than that specific app's folder. I have many different folders for all the different ...

How should I send emails to a long list? (PHP)

I figure I can either use one mail() command with a large Bcc list or have a loop that sends many individual emails. I was just going to use Bcc since that is easiest to program and seemed easiest for the server to handle, but then I have to choose some address for the To field. I can just send mail to the websites own address but it wo...

Ideas for importing text data using PHP array functions

Hello, I am new to php and am asking for some coding help. I have little experience with php and have gone to the php.net site and read couple books to get some ideas on how to perform this task. There seems to be many functions and I am confused on what would be the best fit. (i.e. fgetcsv, explode(), regex??) for extracting data in t...

Converting number formats between php and mysql

I'm sure this is something really simple, like a misplaced quote, but I'm completely stumped. I'm using an update query to enter shopping cart data into a mysql table, and having some major issues with card balance. The column in the mysql table is called BalanceCurrent and it's a decimal(18,2). In my php code (this is a custom Joomla co...

how to code breadcrumbs (php kohana framework)?

hello! is this good way to code breadcrumbs? create table "categories" using mysql create after neccessary columns "parent_id" column if parent_id column have null value it means that this category is parent and if else this columns parent is a column with id which marked in "parent_id" column recursively query to "parent_id" column st...

combining css and js files + css images

I'm playing with this combine.php file and it looks nice, but I'm wondering if there is a work around for my problem. I now have fewer script and link tags for my resources that look and work like they're supposed to <script type="text/javascript" src="http://path/to/server/javascript/libjs/jqueryui/1.8/development-bundle/ui/minified/j...

Problems copying Oracle result set to MySQL

Hi, What I'm trying to do is copy the result of a query in oracle into table in a MySQL database. The reasoning behind this is not important to the question, and I can't really take a different approach. What I am doing is running the query though php, then copying the result into a newly created table in oracle. I know this is not very...

SimpleXML -- Strip CDATA Tags (or embed HTML markup in XML)

I've just recently begun learning XML in the context of PHP and Javascript, and I've encountered a problem. Here's the XML I'm using: http://www.dkarndtcpa.net/new_site/faq.xml (I still can't figure out how to show the code in this little box here...) So the issue is I want to put HTML markup within the XML, and then be able to extrac...