php5

How to change Zend_Db_Table name within a Model to insert in multiple tables

Using Zend Framework, I've created a Model to insert a record into a database. My question is, after $this->insert($data) how can I switch the active table so that I can insert a record into another table? Here's my code so far: class Model_DbTable_Foo extends Zend_Db_Table_Abstract { protected $_name = 'foo'; public function add...

Store database, good pattern for simultaneous access

I am kinda new to database designing so i ask for some advices or some kind of a good pattern. The situation is that, there is one database, few tables and many users. How should i design the database, or / and which types of queries should i use, to make it work, if users can interact with the database simultaneously? I mean, they have...

Stop 2 identical queries from executing almost simultaneously?

I have developed an AJAX based game where there is a bug caused (very remote, but in volume it happens at least once per hour) where for some reason two requests get sent to the processing page almost simultaneously (the last one I tracked, the requests were a difference of .0001 ms). There is a check right before the query is executed ...

Ruby equivalent of PHP's fopen() method

I'm trying to find out if Ruby has en equivalent of php's fopen() method currently used like this: $fd = fopen("php://stdin", "r"); would that be using ARGV variable? Basically what I plan on doing is forward raw e-mail messages using the .procmailrc file which I already got working in a test php file, but the project requires the us...

How to check if an array value exists

How can I check this: $something = array('say' => 'bla', 'say' => 'omg'); How can I check if the $something['say'] has the value of 'bla' or 'omg' Best Regards, ...

How to arrange business logic in a Kohana 3 project

I'm looking for advice, tutorials and links at how to set up a mid-sized web application with Kohana 3. I have implemented MVC patterns in the past but never worked against a "formalized" MVC framework so I'm still getting my head around the terminology - toying around with basic examples, building views and templates, and so on. I'm pr...

how to use a pear package!?

I want to use HTTP_DOWNLOAD to manage my downloads ,, I have never used PEAR before !! HTTP_DOWNLOAD depends on many other packages , I downloaded them and the ones they , in turn , depend on and this is the structure I made : Download.PHP <---HTTP_DOWNLOAD MAIN FILE Header.php <--- HTTP_HEADER MAIN FILE PEAR.php PEAR5.php ...

About Php development

hi actually i m new in programming and i have developed two projects one in osdate and other is my own code >and i am just 6 months older in PHP as developer >i am not happy with my code standard i want to improve that plz anyone can suggest me about standard and how to organized your project before starting ??i know its funny but i don...

How to display Unicode data with PHP

table 'abc' data : tid title 1 வெள்ளிக்கிழமை ஐ. 2 கோலாகல தொடக்க $sql=mysql_query("select title from abd where tid='1'"); $row=mysql_fetch_array($sql); $title = $row['title']; echo $title; OutPut displaying like this: ???????????????? But I want to display வெள்ளிக்கிழமை ஐ. Solution <?php ...

How to fix the open_basedir restriction error?

Hy I have a script called dataface, on a shared host it outputs all the time this warning Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/lib/php/Dataface/FormTool/text.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a4385243/public_html/dataface/Data...

php framework with sqlite, orm, i18n, l10n search addon

im trying to find a php framework to build small,multilingual sites. do you know a php framework with support for: 1.sqlite (it will be little sites so no performance problem and good for copy-paste from development to production) 2.orm 3.i18n & l10n 4.easy search addon 5.ability to just copy-paste no need to change config for goin...

How can i handle a form submit using REAL OOP in PHP

Im used to java and creating UML.. and i was wondering how can PHP be OOP, the objects live only until you make a request.. then they destroy, so if im using a database is useless to create a class and add the members (variables) to the class, they will be useless.. i cant pass the main system object from one page to another, or similar ...

Removing New line character in Fields PHP

Hi, i am trying to upload an excel file and to store its contents in the Mysql database. i am having a problem in saving the contents.. like My csv file is in the form of "1","aruna","IEEE paper" "2","nisha","JOurnal magazine" actually i am having 2 records and i am using the code <?php $string = file...

Crystal Report in php

How I can create a crystal report in php kindly guide me so that I can make it possible. I have tried a lot of code and tutorials but un-usefull for me. I have tried $COM_Object = "CrystalReports12.ObjectFactory.1"; $my_report = "C:\Report2.rpt"; $ObjectFactory= New COM($COM_Object); $creport = $ObjectFactory->OpenReport("c:\report2.rp...

ZF Autoloader to load ancestor and requested class

I am integrating Zend Framework into an existing application. I want to switch the application over to Zend's autoloading mechanism to replace dozens of include() statements. I have a specific requirement for the autoloading mechanism, though. Allow me to elaborate. The existing application uses a core library (independent from ZF), fo...

Is it possible to run a php soap api operation in a web browser

In axis2 on Java it's possible to run operations in the browser by the way you send the url for example localhost:8080/axis2/services/SimpleService?wsdl could have operations implemented by writing urls like so localhost:8080/axis2/services/SimpleService/hello?param0=xxx My Question is can you do the same in PHP5 SoapServer where th...

Define a class dynamically?

Is there a way to dynamically and conditionally create a class definition in PHP, i.e. if (condition matches) include file containing class definition else class myclass extends ancestor_class { .................... } without eval()? My background is the accepted answer to this question. I am looking for the best way to build a ...

Peek ahead when iterating an array in PHP 5.2

Is it possible to "peek ahead" while iterating an array in PHP 5.2? For example, I often use foreach to manipulate data from an array: foreach($array as $object) { // do something } But I often need to peek at the next element while going through the array. I know I could use a for loop and reference the next item by it's index ($ar...

How do I configure Apache to Run Background PHP Processes on Win 2003 w/Apache 2.2?

I have a script, testforeground.php, that kicks off a background script, testbackground.php, then returns while the background script continues to run until it's finished. Both the foreground and background scripts write to the output file correctly when I run the foreground script from the command line using php-cgi: C:\>php-cgi testf...

cystal report calling in php

I want to call crystal report in php. now after searching i reach at that point that it is possible through COM object but now one error is created which is Fatal error: Call to undefined method com::OpenReport() so how to remove it ...