php

Batch insertion of data to MySQL database using php

I have a thousands of data parsed from huge XML to be inserted into database table using PHP and MySQL. My Problem is it takes too long to insert all the data into table. Is there a way that my data are split into smaller group so that the process of insertion is by group? How can set up a script that will process the data by 100 for ex...

How to check with PHP if the script is being run from the console or browser request?

I tried things like $_ENV['CLIENTNAME'] == 'Console' but that seems to work on only certain OS's (worked in windows, not linux). I tried !empty($_ENV['SHELL']) but that doesn't work always either... Is there a way to check this that will work in all OS's/environments? Thanks! ...

taking the value contained in the brackets using php

for example the string is my name is xyz(25) i want to get 25 in a variable through php.. ...

phpsession ID's (hiding)

Is their any way to hide sessions ID's from being sniffed? ...

Basic Crud Application Using Php , Prototype.js and Scriptaculous.js

Hi, I want to develop a web application using php and javascript. There should be functionality of validations, data searching (from tables), sorting and pagination. But my application should be built upon php, prototype.js and scriptaculos.js . I don't want to use jquery and similar tools due to virus issues. Is there any tutorial o...

How to use in_array() for caseless?

It's a big array, so i won't to strtolower every value. ...

Resume abandoned downloads with php ftp?

Is there any way to resume a broken download via an ftp connction established with php? Can php resume a broken download? ...

create table in pdf with wrap data using fpdf in php

Hi all, I have a problem in creating table structure in pdf using fpdf library. when any data of perticular cell have a long string then the cell data will overlap with other cell data. So whole table data has been disordered. then data in pdf will not seem correctly. any one please help me to create table in pdf auto adjust all cells a...

Should different servers translate unix timestamps as different dates?

Whilst working on a UI update for a client, I noticed the dates associated with all the articles were out by a day. I figured I'd screwed something up during my changes, but to be sure, threw together a little php test file that gave me some odd results. The test file is just; <?php $date = 1246053600; echo 'unix: ',$date,', converted: ...

How can I include the output of a Perl script into a PHP page?

We've been asked to support some rather old Perl forms on a new site, as we're using a PHP based CMS we need to include the Perl scripts into our new CMS. I've tried a bit of shell_exec but that's disabled. Has anyone got any ideas? ...

Codeigniter how to conditionally load config files?

I am using CodeIgniter to write a application. I need to create something like this: - I will have: - my_config.php config_production.php config_development.php Now, my_config.php will be autoloaded. From there, if it is production server config_production.php will be loaded. Else config_development.php will be loaded. how should...

Why does the chart disappear when I copy the excel file?

With PHPExcel 1.6.7, i tried to clone a excel file, insert a word in a cell of sheet1 of new file and then save it : $file = "file.xls"; $fp = fopen($file, "r"); $objReader = new PHPExcel_Reader_Excel5(); $xls = $objReader->load($file); //$xls->setActiveSheetIndex(0) ; $xls->getSheetByName('sheet1')->setCellValue('A2', 'bbb') ; $newx...

Error when trying to upload file in PHP

I am php page everything was working fine till today morning. Now the page is not uploading any selected file. All that I keep getting is the following error message: Warning: move_uploaded_file(upload/BrainStream_2009_06_25_23041.zip) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\xampp\htdocs\...

obfuscate or encrypt some plain text data in PHP

I need to obfuscate or encrypt some plain text data in my php 5.2 application. I'd prefer a solution that would have input string and output string retain the same length. This does not need to extremely strong, as there are numerous other layers of security in place. Strong would be good, but this will just keep programmers/dba/suppo...

Quickly Convert (.rtf|.doc) Files to Markdown Syntax with PHP

I've been manually converting articles into Markdown syntax for a few days now, and it's getting rather tedious. Some of these are 3 or 4 pages, italics and other emphasized text throughout. Is there a faster way to convert (.rtf|.doc) files to clean Markdown Syntax that I can take advantage of? ...

How do you handle Zend_Paginator ?

I was looking at Zend_Paginator in Zend Framework project using MVC, and it looks like an intersting tool. It looks like we can give a select object as argument to the factory, it's interesting because it means that i should return a select object from my model, is it a good way to do ? It seems to be a bit heavy to do this, since it w...

Can someone recommend me a good image upload script.

Hi everyone, I'm looking for one of those fancy upload scripts you see on some sites that upload the file the moment you select it on your hard disk, and optionally allows you to crop to a portion of the original image. We use PHP and Prototype (so preferable no jQuery plugins... even though we should probably switch). We currently ha...

A simple explanation of common design patterns for non-native English speakers

I am often facing design patterns, and I find most articles explaining them a bit hard to understand, especially since I don't speak English fluently. I would very much appreciate if someone could explain simply and in basic English the following design patterns: Builder, Prototype, Bridge, Composite, Decorator, Facade, Flyweight, Proxy ...

Loop through multi dimension array to show grid in PHP

I have 3 tables. Apls, Hulls and AplsHulls. Apls consists of id, name, date Hulls consists of id, production_name AplsHulls is a join table and consists of id, apl_id, hull_id, status. Not every Hull is associated with each Apl. The ones that are are in the join table with a status (shipped,in production, etc.) I need to display a rep...

Is the front controller responsible for deciding which controllers/modules to load?

Hi, I am working on a website script, and currently I have a front controller, which determines what to load (e.g. what modules/extensions and controllers) based on the URI. Is this a good approach? I'm using PHP if that matters. I'm just wondering if that's not the front controller's job... ...