php

Has anyone used Lua to build a web application?

I come from a Java and PHP background to build web applications. Has anyone used Lua before to build a web applications? Question: If so, what are the pro's & con's of using Lua versus PHP or Java for a web application? (e.g. web server support, performance, code maintenance, etc). ...

Practical Zend_ACL + Zend_Auth implementation and best practices

Context: My questions pertain to a forum I'm developing pretty much exactly like SO, where there are: guests who have access to view threads but can't reply or vote members who, with enough rep, can edit/vote others threads, and by default they can reply and have the same privileges as guests admins who can pretty much do anything I...

How to implement 301 redirection with PHP/Apache?

When user is visiting by www.domain.name, redirect to domain.name. ...

Sort search results from MySQL by the position of the search query in the string using PHP

I want my search results to be in order of string position from smallest to greatest. For example, searching for "banana" returns: Babyfood, plums, bananas and rice, strained Bananas, dehydrated, or banana powder Bananas, raw Bread, banana, prepared from recipe, made with margarine CAMPBELL Soup Company, V8 SPLASH Juice Drinks, St...

Why specify an explicit database connection?

Hello, I am making a simple blog for myself and while reading through the PHP manual, I found this http://us2.php.net/manual/en/function.pg-query.php It says resource pg_query ([ resource $connection ], string $query ) ... Note: Although connection can be omitted, it is not recommended, since it can be the cause of...

Using R with Apache & PHP

Is there anyway to run R scripts through Apache and PHP? I would like to be able to pass variables from PHP to R. Has anyone done something like this? Essentially, I would like to know if there is a method for passing variables from PHP to R on an apache server. ...

running multiple workers through a long qeue

I have a long mysql queue. I have 1 worker script that processes each queue. but as this worker is running, the database may be updated or get new row inserts. an example worker script get_current_queue = SELECT from queue... while(get_current_queue) { update_current_row_from_queue "processing" //some cpu intensive processing here ...

implementing a site wrapper in php

I just saw joomla's built in component, the wrapper (or was that a module, can't recall). IT is a page where you can show another website(while being in your site). What is the logic behind this? Any suggestions on how to implement this in PHP (I don't know where to start)? ...

Delet data froma a table after certain time interval. lets say (60 mins)

I want to delete data from a table after a time interval has been passed and fill it with NULL value. I basically want that data to get expired after a certain interval of time. Is there any way to do it using Php. database is in Mysql. Thanks. ...

Small table with Link to more information

This may be a newbie question, But let's say I have a database table w/ 10 fields. However, on the first screen I want a small 4-5 field table displaying corresponding data. But the first field, let's call it ID, I want to be linkable to a full table that will display complete details about that, all 10 db fields. What would the codi...

Universal Sorting Function for PHP without the Locale Hassle

I asked a very similar question a while back and I was wondering if correctly sorting an array with UTF-8 chars got a little easier with the new improvements of PHP 5.3+. The solution provided in my previous question works, but I'm looking for a universal solution; one that doesn't depend on the locale specified - kind of what MySQL doe...

Use of PDO in classes

I have a few classes that perform some MySQL queries and prepared statements. However, I am lost in how to incorporate my PDO object within those classes. For example, I want to do something like this: <?php $dbh = new PDO(...); class Foo extends PDO { public $dbh; public function bar() { $this->dbh->prepare('SELECT...

Parse flat file

Hello, Let say i want to read a text file using php. Now my text file contain User=Test Age=18 Gender=F User=Test2 Age=34 Gender=M and following like that. Now let say i want to use php to read the text file and find only value of User= and display it. What is the easiest way to accomplish this? Thank you. ...

Do meta refresh tags "break" PHP sessions?

Hi, I am using session variables to store user display settings while their session is active. For example, if I choose to display 5 items on the page with session variables then there is no problem. I can manually (f5) refresh the page and still see 5 items on the page. However, upon implementing the following meta tag to auto-refresh,...

Tracking database usage using php and Mysql

I am designing a php mysql webapp. In that, a database usage log has to be maintained , which will record 1.User ip 2.Timestamp 3.operation performed(Add,edit or delete) 4.Colmns changed 5.rowid 6.old value 7.new value Please suggest any example scripts. ...

PHP: Return string between two characters

I am wanting to use "keywords" within a large string. These keywords start and end using *my_keyword* and are user defined. How, within a large string, can I search and find what is between the two * characters and return each instance? The reason it might change it, that parts of the keywords can be user defined, such as *page_date_Y...

Building a blog section.. How do I create a menu with all the dates so you can sort between time periods?

I'm currently working on creating my own blog section.. After brainstorming a little while I realized I'm a little stumped. I'm working with php and mysql (with codeigniter framework). The front blog page would show the top 5 post; this I can easily do. How would I go about creating a navigation that allows you to see the years that ...

PHP HTML generated email caches images, thus displaying old images

I'm using PHP to generate an html email which sends my clients latest stats in graph form. PHP generates a new image everytime it sends out stats with the same image name to prevent high disk space usage. Now my problem is the image gets cached thus displaying the old image to the client instead of the new image. My html headers look as...

what i need to do in my code of my website to use CDN servers

i am use a lamp environment , What things I need to pay attention during the development of the site, if the client wants to be ready to use CDN ? thanks ...

How to pass part of url in new link? Using only HTML & PHP

Hi all, I have been trying to attempt to use the facebook share function in my website but i cant seems to have the right result. Say: i have a page called http://www.xxx.com/product.php?prod=lpd026n&amp;cat=43 and i am using facebook's share function to have visitors to share the page in the FB wall. i tried writing the link this wa...