php

PHP coding in real world !!! do I need to learn any Framework???

I know how to write program in PHP and implementation of MVC model. but I really want to practice coding like the coding in real world??? I was wondering is there any specific example or book which can show me the tricks or logic and the way professional programmers consider about coding??? Do I need to learn frameworks like Zend ??? ...

How to achieve auto logoff in php ?

I need auto-logoff system in my application. if user not using the application more than thirty minutes.they should log in again. this is what i need. lastAccessTime should be lesser than 30 minutes. if lastAccessTime exceeds than 30 minutes user should login again with their credentials. (currently i auto log off using Lastaccesstime...

MySQL query cache vs caching result-sets in the application layer

I'm running a php/mysql-driven website with a lot of visits and I'm considering the possibility of caching result-sets in shared memory in order to reduce database load. However, right now MySQL's query cache is enabled and it seems to be doing a pretty good job since if I disable query caching, the use of CPU jumps to 100% immediately. ...

how can i refresh table content without refreshing all the page

i have a table and the content of it is all from data base ,which is a rows of student names and a columns of questions, and with this table an instructor can track the students progress of solving question on real time, so what i want is to update the only the table , without refreshing the whole page, which causes starting at the be...

Openx Ad Delivery Issues

My System Apache 2.2.9 PHP 5.2.9 MySQL client version: 5.1.28-rc Openx v2.8.5 I am using the javascript single page call to serve my ads. I am running an in house CMS where everything is processed through a template.php file. My Issue The success of an ad being served seems to be very hit and miss. The placement or type of the ad ...

How to generate Thumbnails with phpThumb and save it into a file?

Hi all, i wan't to know how to generate thumbnails with phpThumb Class, with an array with file paths already. And then Save the result of each image on other path but with the same name. Thank you all ;) EDIT: I have my code something like this: echo "A iniciar gerador de miniaturas para a área de cliente: \n"; include $wincl...

SQL code to display counts() of value retrieved from another column

I have three tables (these are the relevant columns): Table1 bookingid, person, role Table2 bookingid, projectid Table3 projectid, project, numberofrole1, numberofrole2 Table1.role can take two values: "role1" or "role2". What I want to do is to show which projects don't have the correct number of roles in Table1. The number of r...

PHP $_SESSION nested array is lost when a foreach() dummy name matches array name

Can someone please confirm that the following is a bug with PHP 5.2.13: (thank you) <?php session_start(); if (!is_array($_SESSION["breadcrumb"]["trail"])) { $_SESSION["breadcrumb"]["trail"][] = "trail"; } foreach ($_SESSION["breadcrumb"]["trail"] as $breadcrumb) { echo $breadcrumb; } ?> T...

PHP / Windows - Opendir() fails opening subdirectories within symbolic linked directories

Does anyone know a solution to this problem? I'm unable to open a subdirectory within a symboliclink'd directory. I've confirmed that the paths are correct (even copy & pasted the path into explorer, which parsed it fine). This is a strange, annoying, bug :|. Example: C:\folder\symbolic_link\dir1\dir2 - opening dir2 fails. C:...

Want to show <embed> and <object> tags from YUI editor as a text rather then a video.

I am using YUI rich text editor on my website (php/mysql), so that a user may enter textual matter/articles through it. But if a user copies and paste some embed code in the textarea, from any video sites like youtube, it should get saved as a text block and not as a playing video when showing the text content on the browser. Now YUI aut...

Doctrine enum type by value

I have a column in a table defined as following in my yaml file: myTable: columns: value: type: enum length: 2 values: ['yes', 'no'] In the code I am trying to insert data into this table but I can't figure out a way to insert the data using the enum text value (ie. 'yes' or 'no'). What I was trying was is som...

get meta description tag with xpath

I need the content the description and the keywords tag content. I have this code, but dont write anything. Idea? $str = <<< EOD <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="description" content="text in the description tag" /> <meta name="keywords" content="text, in, the, keywords, tag" /> ...

Ubuntu terminal questions

I am wondering about my VPS providers ubuntu terminal. Are all these terminals the same? I think they are so user-UN-friendly. I can't copy-paste into the terminal, when I try opening textfiles, I can't scroll up and down easily. I cant save easily. Nothing is easy... Is it always like this with Ubuntu? Is there any way to make it e...

How to run php script on server through command line

Hi, I have created a php script to import rss feed into the database. The feed which is huge (from year 2004 to 2010, approx 2 million records) has to be inserted into the database. I have been running the script in browser but the pace it is inserting (approx. 1 per second) i doubt it takes another 20-25 days to input this data even if...

Without using PECL or system() type functions, is there a way to look up DNS records using PHP?

I'm working on creating a new type of email protocol, and in order to do that I had to set up an SRV DNS record for my domain. In promoting this protocol, I'll need to be able to discover if a given host uses my system (and if not fall back to an older protocol). So, is there a way to pull a DNS record (such as SRV) using PHP without u...

crazy things with PHP array...

Hi, A very strange thing, I have an array where element 7 is '[1000137d]', but when I try to compare it by using if ( $array[7] == '[1000137d]' ) it will return a negative. echo $array[7]; echo '<br>'; echo '[1000137d]'; echo '<br>'; echo md5($array[7]); echo '<br>'; echo md5('[1000137d]'); this code would echo out: [1000137d] [10001...

problem binding parameter to pdo statement

Having problem with binding parameters to PDO statement. "orderBy" seems not to be passed to query and results are not ordered as suppose to. When I use "price" in query itself all is good but cannot bind paremeter via bindParam. The code is: class Products { const ORDER_BY_NAME="name"; const ORDER_BY_PRICE_PER_UNIT="price_per_unit"; ...

PHP mcrypt // Chilkat AES encryption -- integration

I'm trying to decrypt a string using PHP which was encrypted using a Chilkat library. VB Encryption: Dim password As String password = "foobar" crypt.CryptAlgorithm = "aes" crypt.CipherMode = "cbc" crypt.KeyLength = 128 ' Generate a binary secret key from a password string ' of any length. For 128-bit encryption, GenEncodedSecretK...

Wordpress Multilingual date

I am trying to set the date appear in the french way e.g "2 Mai" instead of "May 2" here is my code:' <?php // Get today's date in the right format //$todaysDate = date('M d'); $todaysDate = date('m/d/Y H:i:s'); ?> <?php query_posts('showposts=5&category_name=events&meta_key=Date&meta_compare=>=&meta_value='.$todays...

I made a website in English, what's the most optimal way to add one more language?

So, I have created a big website (a lot of text in different files and a lot of programming). I need to add one more language, how should I do? What is the fastest way I can add second language and let my visitors to choose between them? Any ideas? Thanks. ...