php

simplest, shortest way to count capital letters in a string with php?

I am looking for the shortest, simplest and most elegant way to count the number of capital letters in a given string. ...

Use PHP and MySQL DESCRIBE command to build checkbox and radio button menus dynamically

I'm making a data-entry web page in PHP that validates and parses data for entry into a MySQL database. There are more than 30 columns in the database that consist of MySQL SET or ENUM data. If you don't know much SQL, an ENUM datatype column can only hold one value from a collection of ENUM variables that you define when you create th...

Submitting form replaces constant GET information that is needed for the page.

Hi all, I'm learning php and I've got to say I've googled everywhere and I'm stuck :( My question is, in other words, how can I get new variables added to previous variables on the page? Imagine this being www.mysite.com/getvartest.php?orgvar=12345 but after submitting this form it'll go to www.mysite.com/getvartest.php?varselection=...

Php: get results sets from database via mysql

I am encountering a problem while extracting info from a database using php+mysql and thought it will be good if somebody here may suggest a way out. Problematic Code: $selectedProtocols=array(1,2); for($i = 0; $i<2; $i++) { $result = mysql_query("SELECT throughput FROM session where mainProtocol='$selectedProtocols[$i]'"); while(...

Combine KML Polygons in PHP

I have a problem with the Google Maps API only allowing 1000 features per map. In a database, I keep records of areas. Each area has associated with it a heap of KML polygon information, stored as an XML string. Each area is made up of one or more polygons. Given some user input, a handful of these areas are combined into one <Placemar...

How to acess multiple classes through one parent class in PHP

Lets say I have a class called PageBuilder which I instantiate, send parameters to and call functions from through my index file (which acts as a front controller). There are three sub classes associated with the PageBuilder class: Head, Body and Foot, that are accessed by PageBuilder which basically abstracts them for index. So in the...

How can I represent a formula in a way that is understood by both Javascript and PHP?

I'm writing a shopping cart in PHP, and part of its function is to calculate shipping for a given set of products. For users with Javascript enabled, I want to provide the smoothest experience possible by having an accurate shipping calculation done on the client side so that changes in the cart do not require page reloads or AJAX calls....

PHP: Merge 2 Multidimensional Arrays

I need to merge 2 multidimensional arrays together to create a new array. The 2 arrays are created from $_POST and $_FILES and I need them to be associated with each other. Array #1 Array ( [0] => Array ( [0] => 123 [1] => "Title #1" [2] => "Name #1" ) [1] => Array ( [0] => 124 ...

Php: problem with associative arrays....

If i have an array with hundreds of random ids (having values too) like (3=>23,2=>34,17=>670,5=>67...) how can i get an output like following via a loop ID: 3 has a value= 23 ID: 2 has a value= 34 ID: 17 has a value= 670 ID: 5 has a value= 67 I can reference the values by their IDs like echo $myArray['3']; but what if don't kn...

How to get artist name from music file by using php..?

I have a music file having artist name or author name.I want to fetch author details by using php.Is it possible? ...

Is there a way to force open a new browser window from MOzilla to IE by Onclick function?

Hi all, Iam getting new window pop up by using window.open(), but need When i click button in Mozilla browser, a new pop window should open in Internet Explorer, Is it possible...... ...

Create Excel chart programmatically in PHP

Hello, Do you have any idea on how to create a chart in an Excel sheet programmatically from PHP ? I know you can invoke the Excel COM object, but the server is running on a Linux machine... I already use the excellent PHPExcel library but they do not offer the option to create charts. Thanks ! ...

PHP XPATH of HTML document omitting all tags. I want to keep them

I am parsing a HTML document with XPATH and I want to keep all the inner html tags. The html in question is a unordered list with many list elements. <ul id="adPoint1"><li>Business</li><li>Contract</li></ul> I am parsing the document using the following PHP code $dom = new DOMDocument(); @$dom->loadHTML($output); $this->xpath = new ...

How To send SMS to a mobile port using PHP?

Hello Sir, i want to know hte php coding for sending the messages to the mobile port. Help me thanks ...

closing browser after failing to login 3 times

after failing to login 3 times (wrong password, username), i want the browser/window/tab to be closed. how can i do this in javascript or php? and also can you give me some suggestions on what i can do to my system when user fails to login 3 times. thanks. ...

How can I calculate the width of text, in "points"?

I need to get a width of text in some universal points. This calculation should take into account different widths of letters. imagettfbbox() is not an option in my case. Any other ideas? ...

PHP & MySQL & forms -- flexible search? (ex: X ingredients can make Y recipes)

I'm just getting started with PHP/MySQL, so please forgive the rather simplistic question: As a practice example, I want to create a small dbase of recipes. Each recipe has X different ingredients. The table is simple enough I think - each row represents a recipe and each column after the first(primary key) is an ingredient with a TRUE/...

php and file storage on windows servers

My question is related to using a difference drive on a windows server to store files. The partition of the server is too small to handle a large amount of data files, and I want to use the D: drive as the file storage space. My problem is, how do I access the files when they're stored on the D: drive using php? I've tried a multitude o...

fsockopen() [function.fsockopen] : Error through SMPP

I am using SMPP with PHP for sending and receiving messages. I got this error when i am trying to send a message. what is the cause of this and how can i send a message ? thanks. pfsockopen() [function.pfsockopen]: unable to connect to sms.korewireless.com:2777 (A connection attempt failed because the connected party did not properly...

mysql results-to-csv writing function execution doesn't finish on production

I have this function on my controller (Im using CodeIgniter) that reads the database, then produces a comma-delimited string that I feed on print() so the user can save/open the file. On development, the export of about 2000+ records takes about 20-30 seconds. The problem is, on production, the request doesn't finish/goes to a blank pa...