php

Is there any free opensource PHP translit lib?

so I have lots of users posting articles with names in different languages. I need some lib to translate thouse article names to english letters for example turn russian 'р' into eng 'r' and so on for all european languages, russian and asian languages. Where to get such lib? 45 seconds of google gave me this "This extension allows you ...

Question about eval in PHP 5

Hi all, I have been doing PHP stuff for almost one year and I have never used the function eval() though I know the usage of it. But I found many questions about it in SO.So can someone show me a simple example in which it's necessary to use eval()?And is it a good or bad practice? ...

html tag attribute displayed in unicode

I have the following code, from which you can see that, I use the same way to create the text in utf-8. The text shown between html tags are shown correctly. But the text shown as html tag attribute are shown in unicode. I'm positive that on the server side(PHP), both texts are treated in the same way and are encoded in utf-8. Why the t...

Setting an empty default value for a char-column in MySQL?

Hi In phpMyAdmin I have a char(32) column that has no default value(ie. Default: None). When I try to insert data through a SQL query, it throws out an error saying that the column "doesn't have a default value". I need it to be empty, so instead I've just set it's default value as "As defined: " and then nothing in the value field. Is ...

Warning: expects resource but string given

I get: "Resource id #8 Warning: mysql_fetch_array() expects parameter 1 to be resource, string given" Heres the code: $sql="SELECT password FROM user WHERE userid=$userid"; echo $password=mysql_query($sql); while($row = mysql_fetch_array($password)) { $password = $row['password']; } Any ideas? ...

Javascript String Length Differs From PHP mb_strlen

I use document.getElementById("text").value.length to get the string length through javascript, and mb_strlen($_POST['text']) to get the string length by PHP and both differs very much. Carriage returns are converted in javascript before getting the string length, but I guess some characters are not being counted. For example, [b]15...

Fatal Error in uploading to google DOcs using Zend_GData

Hi guys I'm trying the code samples from zend frameworks site on how to upload a document to google docs but I keep getting this error. PHP Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 415 Content-Type application/x-www-form-urlencoded is not a valid input type.' in C:\......

writing CMS in ZEND

Hello guys, I'm trying to write my own CMS using Zend framework and I created modular structure. I have modules like 'news', 'blog' and etc. Also I have "admin" module which has different layout and this is like the administrator panel where admin can edit all the content and etc. But the problem is that I'm looking for the best practic...

can anyone pls help me to retrieve contact from different mailing account?

i am designing a site and i wnt to extract all contact from mail account. like yahoo.. gmail.. msn..etc. please help me how can i handle this... ...

PHP foreach loop help

I am working with a PHP foreach loop and I need it to output some specific HTML depending on which array value it is spitting out. Everytime that the foreach loop hits a $content['contentTitle'] I need it to insert a new table and then from there carry on. Essentially I want the for the loop to spit out a new table everytime a new conte...

replace string in preg_replace

<?php $a="php.net s earch for in the all php.net sites this mirror only function list online documentation bug database Site News Archive All Changelogs just pear.php.net just pecl.php.net just talks.php.net general mailing list developer mailing list documentation mailing list What is PHP? PHP is a widely-u...

Best practices for storing & selecting time/date with php & mysql?

I often find myself storing data in a mysql database, and then wanting to display all sorts of stats about my data, specifically stuff like 'how many rows do I have for this date, or that date'. Does anyone know of (or could write) a good tutorial on this subject? Ideally a good tutorial would overview: Best practices when storing th...

select rows with column that is not null?

by default i have one column in mysql table to be NULL. i want to select some rows but only if the field value in that column is not NULL. what is the correct way of typing it? $query = "SELECT * FROM names WHERE id = '$id' AND name != NULL"; is this correct? ...

php find number of occurances (number of times)

can someone help with this? I need the following function to do this... $x = 'AAAABAA'; $x2 = 'ABBBAA'; function foo($str){ //do something here.... return $str; } $x3 = foo($x); //output: A4B1A2 $x4 = foo($x2);//output: A1B3A2 ...

Converting a html generating php script into a automatic email script

I got this script for creating an HTML page from an image uploader, The only problem is that it overwrite's itself on every upload, I would like to change it so that I get sent an e-mail instead. Ideas? <?php $destination_dir = "uploaded/"; $targetPath = dirname($_SERVER['SCRIPT_URI']) . "/"; $html_start = " <!doctype html public...

In a web app, is it wise to give log files ".txt" suffix?

I am building a logging mechanism in a web application. Being a Windows man, I tend to give files with textual content the .txt ending. The suffix is automatically registered to be opened in a text editor in any Windows environment, and is just a nice convention. The app is going to be redistributed, and running mostly on Linux, though...

select mysql data using MAX

I have a testdata like this: DROP TABLE SELECT_PASS; CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT VARCHAR(20)); INSERT INTO SELECT_PASS VALUES(1,"TC1","PASS"); INSERT INTO SELECT_PASS VALUES(2,"TC2","PASS"); INSERT INTO SELECT_PASS VALUES(3,"TC3","INCONC"); INSERT INTO SELECT_PASS VALUES(4,"TC1","FAIL"); INSERT INTO S...

ORDER BY column_name help (via link in HTML table view) (PHP MySQL

My output for my table in HTML has several columns such as userid, name, age, dob. The table heading is simply the title of the column name, I want this to be a link, and when clicked, the selected column is sorted in order, ASC, and then DESC (on next click). I thought this was pretty straight forward but I'm having some difficulty. S...

Accepting Payment with local debit cards from foreign countries

Hi all. I have an ecommerce website and I am currently accepting payments from visa, master card and all the other major cards. However, one issue I am having is accepting payment from customers using local debit cards. Say someone from China doesn't have a major credit and he wants to use his local debit card, I want be able to accept p...

Is 0 necessary in 0777 here in PHP?

mkdir("/path/to/my/dir", 0700); Thanks ...