php

Complex String Comparisons

I'm trying to write a function in PHP that takes an array of strings (needle) and performs a comparison against another array of strings (haystack). The purpose of this function is to quickly deliver matching strings for an AJAX search, so it needs to be as fast as possible. Here's some sample code to illustrate the two arrays; $needle...

IE8 loses my session data when using payment gateway

This is a really strange problem, that appears to be somewhat intermittent (although it has started consistently occurring now - possibly due to a Windows Update?). My code has previously worked fine in IE7, and continues to work in Firefox, Chrome, and seemingly any other browser but IE8. I'm setting some session data and then passin...

Connecting to MySQL with PHP

I have MySQL running such that I can open a client command line and log on and make databases, tables, etc. I wanted to do some AJAX. Doing AJAX with ASP, SQL Server, etc is not advisable since both places where I am hosting my websites do not use the Microsoft products. So I am forced to do my development with PHP and MySQL. I just ...

Creating thumbnails from a swf file in php?

Hi all, I'm looking for a script that will generate jpg thumbnails on the fly (in php) from a swf file. Does anyone know where I can find something like this? ...

Encoding&compression of URL in PHP

How to easy encode and "compress" URL/e-mail adress to string in PHP? String should be: difficult to decode by user as short as possible (compressed) similar URLs should be different after encoding not in database easy to decode/uncompress by PHP script ex. input -> output, stackoverflow.com/1/ -> "n3uu399", stackoverflow.com/2/ ...

Deleting all files of a directory over a given file size each

I have a bit of script that deletes all .png files in a directory: foreach (glob("*.png") as $filename) { echo "$filename size " . filesize($filename) . "\n"; unlink($filename); } How do I take this one step further to delete all .png files over a certain file size? I have another bit of script that finds out the file size of...

Cakephp Update div

I have a view listing something with some hidden div elements. The hidden div have some data. While showing the hidden div i need to update the div element's text or label? how to do this? ...

php and js // csv to tables (with extras) to csv

I'm trying to find something already made (hopefully) or some tips on where to start, but what I need to accomplish is take an existing csv file, load it into a html table, be able to edit it, or add duplicate rows, then save my edited version as a new csv file. ...

remove everything after first comma from string in php

I want to remove everything(including the comma) from the first comma of a string in php eg. $print="50 days,7 hours"; should become "50 days " ...

programmatically replace SELECT fields in sql query to determine number of results

Given any query (grouping, joins, and subqueries are all possible in any combination), I'd like to break it up with pagination as efficiently as possible. Right now I just run the query, then count the number of rows returned to PHP, figure out how many pages of data that is, display the ones that go on the current page, and output the p...

Good resources on e-shop, e-commerce store Software Design?

Hello All, I'm designing an online store myself from scratch and I' really missing some valuable rources about the common problems and solutions found in designing and implementing a s-shop/e-commerce system Do you know any valuable resource about this I could read (online/book, blogs,etc). Any recommendation? greetz Guillermo ...

Adding classes to Zend_gateway.php

<?php error_reporting(E_ALL | E_STRICT); //error reporting, not needed require_once "Zend/Amf/Server.php"; //the zendAMF server require_once "process.php"; //our test class $server = new Zend_Amf_Server(); //declare the server $server->setClass("process"); //load our test-class to the server ?> If i try to ad...

SMS / Texting solution needed for multiple countries

Hi, I am looking for an SMS solution like the following SMS inbound and outbound. Each country user gets a number in their country to send messages. Each user will get SMS FROM a number in their country. So they can just reply with their message to that number. EG: User in France will get SMS from the site from a French number. The ...

How can a click of a button change the content of a drop down menu?

I would like to make it that when a button is clicked a certain values in a drop down menu appears later on in the same document. For example if there was a button called Honda and it is clicked it would change the content in a drop down menu to the model details of the car. How is it possible to do this? CONTEXT: Webpage on a PHP ena...

Converting PHP Regex's to Javascript (or what are the differences?)

I have a form generator that uses (perl compatible) regexes for ther backend validation. Since the whole form is being dynamically generated it was fairly trivial to add a bit of jquery and then use the same regexes to validate on the client side pre submission. However, some of the time the regexes don't behave themselves in Javascrip...

SQL CODE to do: Trending topics equals a twitter

If i wants count the matching words in a rows of two tables, with milions of rows, sample: Table posts, sample: +----+---------+-----------------------------+ | ID | ID_user | text | +----+---------+-----------------------------+ | 1 | bruno | michael jackson is dead | | 2 | thomasi | michael j. moonwalk...

Page designs to prevent redundant+identical e-commerce orders

Hi, noob question: I'm building a checkout system for an online commerce site. I'm getting the bug where clicking on the "place order" button multiple times will place the order multiple times. I have an idea to load between the button-click page and place-order page with a page that waits several seconds before launching using javascrip...

using mysqli to extract custom data

I am using a function in php for all select queries so that i can dynamically retrieve data from my database ..... I just wanted to know that is my code secure and efficient or if their is a better way to do this, if so please point me to the right direction...thanks class mysql { private $conn; function __construct(){ $this->co...

References on creating Charts/Graphs in PHP ?

Hello Can anyone suggest a book or a tutorial on creating Charts in PHP extracting the data from MySQL Database. It should not involve Flash in any way. I dont want to use any pre-built charting solutions. ...

PHP / SQL picture upload to a database.

I need a php code and sql code that will let someone upload an image to a database. The only thing I can find is very glictchy and not accepted by some browsers. Any ideas? ...