php

Multitenancy with Zend Framework

Just curious as to how people are tackling multi tenancy using Zend (particularly directory structure, database, modularity, per tenant views, etc.). I haven't found too much myself, anyone? ...

How to query two tables based on whether or not record exists in a third?

I have three tables, the first two fairly standard: 1) PRODUCTS table: pid pname, etc 2) CART table: cart_id cart_pid cart_orderid etc The third is designed to let people save products they buy and keep notes on them. 3) MYPRODUCTS table: myprod_id myprod_pid PRODUCTS.prod_id = CART.cart_prodid = MYPRODUCTS.myprod_pid Whe...

How to process URL without specifying parameters

I was wondering if I could process an URL without specifing parameters. For example: http://www.example.com/Sometext_I_want_to_process I don't want to use: http://www.example.com/index.php?text=Sometext_I_want_to_process The site has to redirect to a different page after processing. What language choice do I have? ...

PHP Large report file download issue.

Hi All, Solved I actually found out what is going on here. Turns out it was sending the whole file, but Excel (which I was using to open the result file for testing), will only display 65536 rows. If there are more than that, it will alert something to the effect of "the file is incompletely displayed" and then cut it off after that ...

Php: speed of frameworks

I'm thinking about frameworks. I know they make life a lot easier, but as far as I understand they also significantly burden the server, don't they? I'm looking for some kind of benchmarks, famous frameworks to basic php comparisons. I have a will to create a kind of my own framework - a way simplier (no ORM and other cool stuff, only ...

Ruby (on Rails) && PHP - two great things that work great together???

I've done very little work with Ruby, and have an app I've written in PHP. I would like to add some functionality which is available in open sourced Ruby code. I could either try to translate the Ruby to PHP, or try mixing the two. Though I think the mixing part would be somewhat silly. I believe my options are to either mix ruby wi...

Can't diagnose my MySQL root user problem

Hi all, I have a problem with the MySQL root user in My MySQL setup, and I just can't for the life of me work out how to fix it. It seems that I have somehow messed up the root user, and my access to databases is now very erratic. For reference, I'm using MAMP on OS X to provide the MySQL server. I'm not sure how much that matters thou...

Template language vs. straight PHP

I'm going to write a CMS, but right now I'm writing down all my ideas and trying to get all of my concepts straight before I start. One of the things I'm torn on is whether to use a template language and parse the pages of the website, and replace template tags with content items, or just develop the site with straight PHP and have the C...

One 'compressed' file of classes vs multiple class files in PHP

Is there any gain to combining all of the classes for a project into one massive 'compressed' file (spaces and comments removed) vs loading each class as they are required (other than all of the classes are there so you don't have to require/include them, isn't that what we have __autoload for?)? It seems to me that loading each class a...

How does a Magento Payment Method Module integrate with the site's back-end

I found this related question which confirmed a lot of what I already thought but one question remains; how does a custom payment module integrate with the store's database? I am developing a custom payment method that transfers the user to a secure site, hosted by a bank in Australia which will process credit card transactions. For t...

Proper way for count empty variables

Hi, I use kohana and when you try to fetch data from database it returns class variables(like $user->firstname) as a database data. User table have a 12 columns and i fetch 8 columns but at this point some of columuns maybe empty(like $user->phone). How can i found empty column number ?(Proper way..) Thanks A Lot ...

How do scripting languages use sockets?

Python, Perl and PHP, all support TCP stream sockets. But exactly how do I use sockets in a script file that is run by a webserver (eg Apache), assuming I only have FTP access and not root access to the machine? When a client connects to a specific port, how does the script file get invoked? Does the script stay "running" for the durat...

Easy, Robust IPC between Python and PHP

I have a python program which starts up a PHP script using the subprocess.Popen() function. The PHP script needs to communicate back-and-forth with Python, and I am trying to find an easy but robust way to manage the message sending/receiving. I have already written a working protocol using basic sockets, but it doesn't feel very robust...

Help with PHP method_exists()

Hi I am writing a "catch all" method for my controller for ajax. It is called 'ajax' :P This is what it currently looks like public function ajax($method = null) { if ( ! $method OR ! request::is_ajax()) { return false; } if (method_exists(array($this, 'searchModel'), $method)) { echo $this->searchMode...

Can I BInd One Row of an array to a drop down list?

Hello, is it possible to bind one row of an array to a drop down list? The situation is I have a query that pulls the following data and puts it in an array using php: student_id class teacher_code times THe idea is that I want the user to be able to book a time with the teacher of the class and only display the NON Booked times. Obv...

creating a mysql search string dynamically?

Hi all, I'm trying to create a simple search page, but I'm not 100% sure how to write the actual search string (using the appropriate AND's etc if the variable exists) here's the code: if ($post) { //get all search variables $type = JRequest::getVar('type'); $classifications = JRequest::getVar('classifications', array(0), ...

how to override joomla module's method ?

Hi, I have a template that need to override the joomla module method (not template). I know how to override the template (tmpl) by creating /html/mod_abcd/ ... but is it possible to override the joomla module just for my templates ? I am using mod_frontpage and it seems the mod_frontpage delete things inside bracket ({ ... }) so i just...

Multiple values in one attribute (such as class) in simplexml (using PHP)

If I try to add the same attribute twice to an element via simplexml, I get the following error: Warning: SimpleXMLElement::addAttribute() [function.SimpleXMLElement-addAttribute]: Attribute already exists... As a workaround, I'm using if-else statements for the three possibilities: if ($a && $b) { $node -> addAttribute("class", ...

cookie with php and javascript

Can I edit a cookie created by javascript with php and vice versa is a cookie a cookie basically? ...

Can you get a method name from within a method in PHP?

Is it possible to do something like this? public function something() { $thisMethodName = method_get_name(); // I made that function up, but is there some way of doing what it describes? } Thanks ...