php

Remove first and last instance of a string?

How can I remove the first instance of a certain piece of html from a string. I'm looking to remove </tr> </table></td> </tr which is near the begining, but it also appears throughout the string. I also need a way to do the same thing but the last instance of it. Anyone know? ...

upload database file on iphone using PHP - considerations?

I have seen plenty of posts on uploading files from iphone to a server but are there any considerations that need to be factored into code with this functionality. Currently my app uploads a DB file using PHP OK but will this always be the case?, i.e. from different locations in the world, and what kind of precautions do I need to take ...

how to make a multi-lingual php site?

I am developing a site using php and mysql. I want to know... what's a good way to deal with multi-lingual support? I want a user to be able to select from a drop down and select their language. Then everything (content, buttons, links) except the user-written content is in their language. What's a good way to approach this? Use a cooki...

PHP framework of intermediate complexity, in between CodeIgniter and Yii ?

Something easy like CI (this means mandatory good, easy, up to date documentation). But also with some more features than CI. Yii has lots of features, but it is also more complex (and it kind of forces you to have to use lots of it features). That means adding some functionality to your web-app takes three times as long because you hav...

Using ZendStudio with XAMPP

I had installed XAMPP, as a matter of convenience, since it installs php, apache (which is what I need) and, in addition, it installs other things like MySQL, but I'm not going to use now. In XAMPP, I enabled the mssql module (editing the php.ini), to use the connection to Microsoft SQL, and everything works fine. Now, I'm wanting to d...

ubuntu aptana 3 php helloworld !!

I have Ubuntu x64. I've already installed XAMPP and it's working fine with NetBeans. I wanted to use Aptana 3, so I downloaded and uncompressed it, and clicked on "aptanastudio3". The program started fine, so I made a PHP file, and now I have no idea what to do; the run button gets me "external tools configuration". I googled and found...

problem with drupal when I change some configuration

I am a drupal newbie. Can anyone tell me what is the meaning of such warning. warning: Parameter 1 to profile_load_profile() expected to be a reference, value given in /data/multiserv/users/395147/projects/730411/www/includes/module.inc on line 462. The line on question contains : ** * Invoke a hook in a particular module. * * @pa...

Converting UTS (UTC-0) times to BST in PHP or jQuery

I'm pulling the most recent listened tracks from last.fm and putting them on my website. Problem is, the times are retrieved in UTC-0 uts format and appear to be an hour out when comparing them to BST times in order to calculate a fuzzy time stamp ("about 5mins ago", "about an hour ago" etc). Is there any way solve this so the times al...

php: check if an array has duplicates

I'm sure this is an extremely obvious question, and that there's a function that does exactly this, but I can't seem to find it. In PHP, I'd like to know if my array has duplicates in it, as efficiently as possible. I don't want to remove them like array_unique does, and I don't particularly want to run array_unique and compare it to the...

PHP: Very simple Encode/Decode string

Is there any PHP function that encodes a string to a int value, which later I can decode it back to a string without any key? ...

PHP code problem...

I'm trying to insert the following code below into the other piece of code where it says INSERT PHP CODE HERE.. but I don't now how to correctly do it? The code I want to insert. if (!empty($f)) { echo $f; } else if(!empty($u)) { echo $u; } else { echo 'someting'; } Here is the other part of the code. if(!empty($avatar))...

Can I use a database value right after I insert it?

Can I insert something into a MySQL database using PHP and then immediately make a call to access that, or is the insert asynchronous (in which case the possibility exists that the database has not finished inserting the value before I query it)? ...

How to count characters including white space and then break onto a new line after a certain length using PHP

How to count characters including white space and then break after a certain length for instance how would i break a string after 25 characters onto a new line using PHP? ...

How extract XML data using PHP

Hi, I am required to extract the information at a particular "area" of this large collection of xml. But i'm not familiar with extracting xml. I've looked through the site and tried various ways but all i get back is "Error in my_thread_global_end(): 1 threads didn't exit" Here's the url of the xml i'm getting my data from: ftp://ftp2.b...

PHP MYSQL: How to get ambiguous column result from joined table

Hello, If I am joining two tables and the result set will have ambiguous coloumn names, how can I retrieve the correct one through php? Example: $results = mysql_query("SELECT b.name, m.name FROM Brands as b INNER JOIN Models as m ON b.id = m.brand_id", $connection); while ($row = mysql_fetch_array($results)) { printf("Name: %s", $r...

Is this the standard behavior of PHP?

This works without warning: function test($a) { echo 1; } test(2, 1); This will cause warning: function test($a) { echo 1; } test(); If it's standard, any reason for this? ...

how to detect incoming chat message?

I'm using PHP, AJAX, a MySQL database, and a lot of jQuery to prototype web-based chat system (similar to Facebook Chat). I'm stuck on how to "listen" for incoming chats... when to know someone is trying to chat me... and to know that it is a new chat, not an existing chat. Right now, I'm polling to see if there has been new insertions ...

How to output javascript Date in json

I am trying to the timeline chart: http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html#Data_Format Data is coming in the form of a JSON feed. Google wants the data as something like this: { version:'0.6', reqId:'0', status:'ok', sig:'4641982796834063168', table:{ cols:[ ...

Using Simple_Html_Dom Find with 2 attributes

Hey, Does anyone know how i could use simple_html_dom's find function to find an html element specifying 2 attributes instead of 1? Like right now I was using $area2 = $html->find('td[width="450"]'); but say I want to also specify the height for the object, etc How could I do it? Thanks! ...

Making a custom PHP form by using a custom API

I am trying to make a simple module for phpBMS. It is mostly straightforward, and it is quite easy to make a form and define a table to add, remove or modify records. Here is the sample provided by the project, which is what I have been following so far. Now, I have a more complex need than simplifying adding or modifying records. I ...