php

PHP array has only one entry,how to get its key?

$arr['thisiskey'] = 1; Like above,how to get "thisiskey" programmatically? ...

How to check and see an images extension using PHP?

How can I check to see if the image is a PNG, GIF, TIFF and JPG and if so create the thumbnail and save it to the thumb file. So far I can check and save for JPEG images. Here is the code below. <?php //Name you want to save your file as $save = 'members/3/images/thumbs/thumb-pic.jpg'; $file = 'members/3/images/pic.jpg'; echo "Creat...

How auto updated the database without refresh with ajax?

hi. i'm new here. i just create a code which can read the data from mysql database. But when i add in new data inside databse, my php page cant updated own automatic. I want the page can updated automaticly withour press f5 button and refresh. Can anyone help me solve this? Get any misstake?? <script type="text/javascript"> function...

Running a php cron job - problem with execution time

Hello, I have a site where I download data from one site using cUrl a then generate a image from it, which is stored on the server and displayed on other websites. I've got everything working perfectly, except from a cron job. Whenever I run this script it stops after a while (it's more than 30 secs though, more like 2-3 minutes, it's...

is there a servicebus solution where consumers don't consume events? (multiple consumers receive same event)

Hi, I was reading up on ActiveMQ which seems like a great implementation of a servicebus where producers can post messages and other processes can receive them. However when reading the documentation, it looks like the producer has to give the 'endpoint' when sending a message. I would rather have it the other way around: My producer ...

How to prevent multiple login in PHP website

I want to prevent multiple log in in php application. Firstly, I create login status(active, notactive) in user table. when user A login the user status will be set to 'active', and if the user logout the status will set to 'notactive'. when another client try login using the same user acount, I check the user table. if the user still ...

What is better extra query or extra column in database?

What is better extra query or extra column in database for data that will be available very less time. Example: In Case of sub user management either i add one extra column super_user_id in main users table and make enrty if users types are sub_user and the default column value is -1 or i create new table and manage sub user in that tab...

Removing duplicate field entries in SQL

Is there anyway I can erase all the duplicate entries from a certain table (users)? Here is a sample of the type of entries I have. I must say the table users consists of 3 fields, ID, user, and pass. mysql_query("DELETE FROM users WHERE ???") or die(mysql_error()); randomtest randomtest randomtest nextfile baby randomtest dog anothert...

What has this e-commerce store been made with?

Hi, I really like this e-commerce store - http://www.gonedigging.co.uk I have had a dig with firebug but cannot tell how it has been made, is it a bespoke job or an open source package? Who can help me? ...

A Div section not executing

In my below given code, the second DIV section is not executing. The PHP code contained therein is not executing. I added a test echo, but it is not displaying it also. Why the control is not reaching there. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <head> <meta http-eq...

What's the kind of job that c/java can do but PHP will be hard to do?

Here,job is something like a complete utility. I need to know this to start the c/java journey! ...

Check Duplicate Array

Dear All I have 10 input or more and need to check for this array do not duplicate. if duplicate entry from user will be show that error to user too. sample Check array qty[] if dup. will be show and can not entry <input name="qty[]" type="text" class="InputBox" id="<? echo "qty".$i?>" onBlur="sumTotal('qty[]')" onChange="sumTotal('q...

Negative integers to percentage

I have a lot of files with data to convert to percentages using basic math functions: <param id="1" name="otb" value="0.160"/> <param id="2" name="blm" value="-0.210"/> <param id="3" name="mep" value="-0.010"/> <param id="4" name="plc" value="-0.100"/> Each id get's it's own equation: (n-(-.3))/2.3*100 (n-(-.8))/3.3*100 (n-(-.5))/1....

PHP Best practice books?

Hello, I've been programming for a 'few' years now and ofcourse I'm always trying to improve myself. That's why I'm looking for some good books and especially 'best practice' books with things like: What to do What not to do What is more efficient/Optimization Clean and tidy programming Maybe it doesn't have to be php specific but ...

PHP benchmark functions timer script

I have two functions whose execution time I would like to compare: function subject_one() { $str = preg_match_all( ...[SNIP]... ); // ...[SNIP]... return $str; } function subject_two() { $reader = new XMLReader; $writer = new XMLWriter; // ...[SNIP]... echo $str; } Is it possible to write a function to do ...

A public static function in a class not executing.

I have a .php file with HTML code also in it. Through this file I am calling a function in another .php file that resides in a class. The call is not working. It is simply not entering the function in the class. Below are the codes of first and second file respectively. <div id="sectionGrid"> <!-- Begin of Grid Section --> <table ...

(pdflib) Table of contents with dynamic page numbers

Hi, I'm on pdflib 7 under php5 and I'm drawing a statistical report with several sub topics over several pages. Now, I want to include a table of contents on the first page where every sub topic is listed with it's actual page number. Needles to say that I don't know those page numbers at the time I draw the table of contents. Is ther...

specifying date format when using $form->inputs() in CakePHP

hi all, I am wondering if there is a way to specify the date format in the forms created using CakePHP's $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() that will create the whole form fields automagically. Any input will be appreciated. Thanks. ...

Remove item from array if it exists in a 'disallowed words' array

Hello all, I have an array: Array ( [0] => tom [1] => and [2] => jerry ) And I also have a disallowed words array: Array ( [0] => and [1] => foo [2] => bar ) What I need to do is remove any item in the first array that also appears in the second array, in this instance for example, key 1 would need to be re...

how to properly handle international character in Php / MySQL / Apache

I need to create an application in Php that can handle all unicode characters in all places - edit fields, static html, database. Can somebody tell me the complete list of all parameters / functions that need to be set / used to achieve this goal? ...