php

Show indexes in MySQL table

If I define a MySQL index over two fields, how do I find out, which two belong together (using MySQL commands). Here is an example table: mysql> DESCRIBE lansuite_wiki_versions; +-----------+-----------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default...

MongoDB - help with a PHP query

Hi guys, I have the following object stored in a MongoDB: [_id] => MongoId Object ( ) [horses] => Array ( [0] => Array ( [name] => Youve Been Mowed [selectionId] => 3004097 ) [1] => Array ( [name] => Rascal In The Mix [selectionId] => 3460932 ) [2] => Array ( [name] => Clumber...

How to see if the date is later than 8 days?

Hi all, i have a string field (and i can't change this because the date format) on mysql database that contains a date (Like: "01-03-2010"), and i wan't to make a function to compare that date and return true if today's date is newer than 8 days, and false if the date is lower or bigger than today's date... Example: 01-03-2010 < (08-06...

How to parse ZendGData Picasa GPhotoTimestamps in PHP

So, i'm having a lot of trouble with this little piece of code. An example timestamp is this: '1278509422000'.. the problem is that it comes in as a string and I have to convert it somehow. I know about the problem with milliseconds and have tried dividing by a 1000 and much more (intval/floatval) but it just will not become a correct da...

Php restricting the data insertion in mysql

Hi, I have a list box with two times i.e 12:00 to 2:00 and 2:00 to 4:00.I want to do that when someone submit the form (example a meeting reservation form) the timing inserted into the databse should be booked only for three times.when someone tries to insert the same time for the fourth time,it should give us message like (already book...

REGEX URL regular expression

Is this regex perfect for any url ? preg_match_all( '/([www]+(\.|dot))?[a-zA-Z0-9_\.-]+(\.|dot){1,}[com|net|org|info\.]+((\.|dot){0,}[a-zA-Z]){0,}+/i', $url, $regp); ...

PHP newbie CURL and array question

UPDATED: I've simplified the code (tried to) I'm trying to download a series of images as set in an array, but something is clearly not right: function savePhoto($remoteImage,$fname) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_NOBODY, true); curl_setopt ($ch, CURLOPT_URL, $remoteImage); curl_setopt ($ch, CURLOPT_RETU...

How to find the centre of a grid of lines on google maps

Hi, I'm struggling with a problem with some GIS information that I am trying to put into a KML file to be used by google maps and google Earth. I have SQL database containing a number of surveys, which are stored in lines. When all the lines are drawn on the map, they create a grid. What I am trying to do is work out the centre of th...

PHP $_SERVER[‘SERVER_ADDR’] variable always returns 127.0.0.1

We have multiple load-balanced webserver machines running the same PHP webapp (LAMP) and I'd like to run slightly different code on each server (for testing purposes). I was hoping to use the $_SERVER['SERVER_ADDR'] super global to do something like this: if ($_SERVER['SERVER_ADDR'] == 'XXX.XXX.XXX.XXX') { echo "Do one thing"; } elsei...

What can be the maximum size for the $_SESSION ?

I am importing a csv file with more then 5,000 records in it. What i am currently doing is, getting all file content as an array and saving them to the database one by one. But in case of script failure, the whole process will run again and if i start checking the them again one by one form database it will use lots of queries, so i thou...

how to show friend list in home page,using php my sql?

if an user login in his/her home page then he needs to see his friennds, i hane one table name frienddetails containing userid and friendid,and another table name profile containg userid,name.now how can i show user's friend in the home page? the friend details need to show in user home page,but that is in the table named profile. ...

Calling a PHP page with MySQL query from Javascript function then returning results to another javascript function

I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that ins...

variable number of parameters from a url/paramname/valueparam in an array ?

hello, basicly I would like to read url params in an array so finding params don't depend on their place in url I have a url for seach with controller/action/paramA/valueparamA/paramB/valueparamB theses params are optional : I have direct url with search params inside to read params from url we have to use action(valueparamA, valuepara...

Selected Text Instance

I have a bunch of text on my document. You can select word/words from it and highlight the text. After you highlight it, an ajax request is sent and the selected word/words are sent to backend (PHP) and processed to be saved into the database. The page is refreshed and the selected text is permanently higlighted. Now the bad part, if yo...

Converting Digits into string

Hi All , 1)I have been working on fetching data from an excel sheet i can see on a cell written "Oct-10" but when i select it i see "10/31/2000" on fx column right at top ,when i fetch data from the .xls sheet using http://phpexcel.codeplex.com library version number 1.7.3 ,it is returning float("40482") , can any body tell how to conver...

how to view reports of jasperserver in php

hi guys i am a fresher n don't know about java. i created and published some reports to jasperserver using ireport, now what i have to do is insted of logging into jasperserver i have to view my reports in myown site. i tried it by using php/java bridge but not got the solution. can any body provide me the steps to be followed in cl...

Best PHP form generation & validation Framework

I'm looking for best framework in order to generate and validate forms in php. I would really like it to be based on smarty too. Any suggestions? ...

Convert php site to .exe desktop app

Hi all, i have developed a php-mysql web application, which is a school based project. My client wants the this application to be converted into a .exe file such that it can be installed on his desktop and use it. How can the php website can be converted to a .exe file and can it be run without the need of a database/server software ? ...

What is the best way to run PHP 4 and PHP 5 side-by-side on the same Apache server?

I have a unique requirement where I want to run PHP 4 and PHP 5 on the same web server. How do I acheive it ? ...

How to use each bit of memory sensitively in PHP

Hi all , Can any body give me a a introduction of how to program efficiently minimizing memory usage in PHP program correctly and generate my program results using minimum memory ? ...