php

How to add columns to CSV using PHP

I need to add columns to an existing csv file ,but i can't find any solution to the problem.I have used "\t" and chr(9) to create columns but no success so please help me by providing me the right solution if any one can ...

how to subtract two dates and times to get difference

i have to sent an email when a user register email contain a link that is become invalid after six hours what i m doing when email is sent i update the db with field emailSentDate of type "datetime" now i got the curent date and time and has made to the same formate as it is in db now i want to find that both these dates and time have di...

I have two arrays.I want to check which is the common element in php

Imgagining i have two array arr[]={"red","blue","green"} arr2[]={"red","violet","black"} How will i compare the two array to get the result that i common to both of the arrays.. For this the result is red... How wil i do this in php(simple means)...Can anyone suggest??? ...

Zend Db Field Comments

Hi All, does anyone know if you can get individual field comments from mysql using Zend Db. What im working on is a registration form that gets all its fields from the db table. At the moment im using the field names to generate the labels for the form elements however it would be much better to get this data from the information_schema...

MySql Transactions

So I have two methods. Method one adds a row to my database. Method two selects and updates the latest 10 rows of the table. If method one adds a new row after method two selects the data but before it updates it will method two update the wrong 10 rows? Will transactions help here or do i need to lock tables? function one(){ inser...

API services with PHP learning resources

Hello I want to learn API access systemically and I would like some recommendations for books/sites that cover the subject. I have limited experience with the Google Checkout HTML system, so I'd like to understand the xml system for that. I'll need examples to be written in php/xml. Basically, I need to get to know the nuts and bolts ...

a simple php syntax question.

hi, i just want to know from below code what does ? and : specify, i would appreciate if someone explain me the below code. thank you $country = empty($_POST['country']) ? die ("ERROR: Enter a country") : mysql_escape_string($_POST['country']); ...

Which the online project manager is best for php-development?

preferably free demo :) In other words, I want to know who uses which project manager... ...

Cannot save characters of my language

Hi, I am trying to save some data(name, last name) in my forms with php and mysql. It's simple form like: <input type='text' name='first_name' /> And php gets it after submiting with: $first_name = trim(mysql_prep($_POST['first_name'])); The problem is, that if I type characters in my languege(lithuanian), it won't save them and w...

In PHP, if a variable holds a datetime, what does operator-- do?

My background is C, Java, C#, and VB.NET, but I have to work on some basic PHP stuff. I've gotten to this line of code: if($flag) $event_end--; What exactly is being decremented? The raw ticks? $flag (I think) represents if the event is an all-day event, where the start would be 7/1/2010 and end would be 7/2/2010. Does the -- esse...

setting home (default) page in a directory

Hi All, It's been a while since I created a new directory on my domain (call it my/domain/dir3). I have others, each containing a index.php (dir1/index.php - dir2/index.php), each index is called if the directory URL is called (thus a URL of my/domain/dir1 will call my/domain/dir1.index.php). No the embarrasing part ... I've completel...

PH&Sessions: Is there any way to disable PHP session locking?

Hi. Is there any way to disable the session locking in PHP while using the default session handler? [EDIT:] Or is there at least a way to restart a session after calling session_write_close()? `session_start()' does not work if any output is already sent to the browser. Thanks, Taloncor ...

php convert floating point to long (convert to string to pass to a xml function)

Hi, PHP converts a large number to floating point which I need in "long" format to pass to a soap xml api. ((round(time()/(60*15))*60*15)+(30*60))*1000 This gives the result: 1.28E+12 Whereas, what I need is: "1280495700000" in order to pass to the api ...

php webservices to twitter

can i tweet from webservice to twitter using oAuth? Could anyone please tell me what I should do? ...

mysqli prepared statement with operator

Hi, I am trying to do the following: $search_query = "SELECT spec, title, quantity, location_to, location_from FROM sm12761.assignments WHERE title = ? LIMIT 0,1 "; But change it to WHERE title LIKE '&something%' How would I do this ? If some one could show me a refactored version of the query that woul...

Replacing accented characters php

I am trying to replace accented characters with the normal replacements. Below is what I am currently doing. $string = "Éric Cantona"; $strict = strtolower($string); echo "After Lower: ".$strict; $patterns[0] = '/[á|â|à|å|ä]/'; $patterns[1] = '/[ð|é|ê|è|ë]/'; $patterns[2] = '/[í|î|ì|ï]/'; $patterns[3] = '/[...

Loose telephone regex validation

I've been trying to find a validation regex to do some loose validation on phone numbers. I'm going to strip some of the stuff out when I use them, but I would like to allow the user the freedom to enter their number as they want, and I want to display it as they have entered it. I figured that the best thing to do is whitelist my chara...

Put all dropdown selected values in url params on change event of any dropdown ?

I have three drop downs in mypage.php: <select name='vehicle'> <option value=''>Select</option> <option value='bus'>Bus</option> <option value='bike'>Bike</option> <option value='car'>Car</option> </select> <select name='color'> <option value=''>Select</option> <option value='red'>Red</option> <option value='blue'>Blue</o...

echoing a php string with a wordpress include

hey. with the following code <?php if (qtrans_getLanguage() == "en") { echo <?php include( TEMPLATEPATH . '/slider_en.php' ); ?>; }else{ echo <?php include( TEMPLATEPATH . '/slider_de.php' ); ?>; } ?> i'm trying to include a file, based on the chosen language of the website. guess my idea is right but i'm totaly wrong on ...

Including a file via variable

This seems like the most basic thing in the world, but I don't know PHP. I am trying to include a file on my page, and the directory of that file is specified inside of a variable. <?php $pageGroup = 'news'; $directory = 'http://localhost:8888/includes/'.$pageGroup.'/rightCol.html'; include($directory); ?> When I echo the...