php

What is your favorite new feature in php 5.3?

I'm trying to compile a list of new features found in php 5.3. that I have to check out as time permits. I'd like to do this in the order of usefulness of the features. The question is subjective, that is the point. I want to end up with a list ordered by what the community likes. Such a list would hopefully be useful to many and the I ...

PHP header Location works in the middle of HTML

Hello. I'm having problems understanding how a header("Location: http://www.google.com/"); can work in the middle of a HTML page's <body>. Shouldn't there be an error since the header has already been sent due to the HTML output, way before the <?php ... ?> part started. I'm referring to the warning Cannot modify header information - h...

__autoload disaster - conflicts with Joomla

I have just changed all my code to use __autoload to find that it conflicts with the joomla autoloader. I integrate my app with joomla in some cases to register users etc. I found spl_autoload_register() with aparently allows many autoloaders. What should I do? update: this is what joomla does Loads this file from /library/loader.ph...

Associating multiple MySQL queries w/ PHP?

I am trying to create a simple inventory request system. A user can enter multiple SKU's that will query the inventory database. My problem is I am trying to do is associate these multiple queries into a type of list. This list can later be retrieved and contains all queries that were submitted simultaneously. When the list is filled i...

where we use object operator "->" in php

what are the diff ways where we can use object operatos -> in php ...

Possible to select...for update, do e-commerce transaction, and then call a MySQL stored procedure in PHP?

Hello, I am currently building a PHP e-commerce website for my client. Its been going smoothly but I've hit a roadblock and was wondering if any MySQL/PHP experts can help me. Basically, the e-commerce site sells a product only once (meaning they only have one quantity in stock for each item), which means that once a customer checks out...

Zend_Search_Lucene vs SOLR

Hi, I have recenlty stumbled into Zend Lucene port of Lucene project. I have a little bit experience with SOLR so I would like to know what is the difference between two of them especially from performance and installation side. As much as I know SOLR requires Tomcat serverlet running in web hosting in order to work, what about Zend L...

How to remove list from <?php the_category() ?>

I am using wordpress and I am wondering how do I get just the permalink and name of the category of a post when using: <?php the_category() ?> The above outputs a list and I just want to be able to wrap the permalink and category in my own markup ...

Trouble with MySQL: CONCAT_WS(' ', name_first, name_middle, name_last) like '%keyword%'

hey folks, I'm setting up a keyword search across multiple fields: name_first, name_middle, name_last but I'm not getting the results I'd like. Here's the query: "SELECT accounts_users.user_ID, users.name_first, users.name_middle, users.name_last, users.company FROM accounts_users, users WHERE accounts_users.account_ID = '$acc...

How to inject php code from database into php script ?

I want to store php code inside my database and then use it into my script. class A { public function getName() { return "lux"; } } // instantiates a new A $a = new A(); Inside my database there is data like "hello {$a->getName()}, how are you ?" In my php code I load the data into a variable $string $string = loa...

Codeigniter PHP multiwindow issue

Problem arise when user opens multiple window. In my application say when user click on the project info, the project id will be stored in session variable and when saving it will be save against the project. but if the user open project1 and opened project2 in seperate window, there creates a problem when the user clicking save on proje...

memcached vs. internal caching in PHP?

Hey, I'm working on some old(ish) software in PHP that maintains a $cache array to reduce the number of SQL queries. I was thinking of just putting memcached in its place and I'm wondering whether or not to get rid of the internal caching. Would there still be a worthwihle performance increase if I keep the internal caching, or would me...

wordpress servlet mapping not working

I have the latest Wordpress running on Tomcat 6.0.26 virtual host with Quercus PHP servlet. It works, except when I try to use perm links. A url such as /index.php/my-page-name doesn't seem to ever hit the PHP servlet . It gets a browser error that request resource is not available. It's like it isn't matching the servlet urlmapping. ...

[PHP] Script looking for string in file breaks

Hey guys. I'm running a script that looks for a specific term in a pdf file. Well, actually I'm reading the pdf file as a txt file and look for the term there. The script processes over 20k files. But, unexpectedly, the script breaks after it hits a file that is over 50mb long. It stops. What could the reason be? Here's an excerpt of th...

Mysql Limit column value repetition N times

Hi at all, is my first question here, so be patient ^^ I'll go directly to problem, I have two table Customer (idCustomer, ecc.. ecc..) Comment (idCustomer, idComment, ecc.. ecc..) obviosly the two table are joined togheter, for example SELECT * FROM Comment AS co JOIN Customer AS cu ON cu.idCustomer = co.idCustomer With this I se...

Creating tables with EZPDO

Hello everybody. I'm starting with EZPDO and was wondering if there is any way to, having the PHP class, construct the DataBase diagram. For example. I've this class: <?php /** * class Localidad * @orm mysql://xxx:[email protected]/yyy */ class Localidad { /** * @orm integer */ public $id_alquileres; /** * @or...

How to combine these two PHP arrays ?

I have two arrays in php that are part of an image management system. weighted_images A multidimensional array. Each sub array is an associative array with keys of 'weight' (for ordering by) and 'id' (the id of the image). array( 156 => array('weight'=>1, 'id'=>156), 784 => array('weight'=>-2, 'id'=>784), ) images This array ...

PHP Array Efficiency and Memory Clarification

When declaring an Array in PHP, the index's may be created out of order...I.e Array[1] = 1 Array[19] = 2 Array[4] = 3 My question. In creating an array like this, is the length 19 with nulls in between? If I attempted to get Array[3] would it come as undefined or throw an error? Also, how does this affect memory. Would the memory of 3 ...

Word 2007 COM - Can't directly access a page when word is set to invisible

I'm using Word 2007 via COM from PHP 5.2 Apache 2.0 on a windows machine. The goal is to programmatically render jpeg thumbnails from each page in a Word document. The following code works correctly if you set $word->Visible to 1: try { $word = new COM('word.application'); $word->Visible = 0; $word->Documents->Open("C:\\tes...

PHP, what is the better choice for removing a known string?

I am looking to search for and replace a known string from within another string. Should I use str_replace() or preg_replace()? The string to be replaced would be something similar to [+qStr+], [+bqID+], or [+aID+] and it would be being searched for in a code chunk similar to this: <li> [+qStr+] <ol class="mcAlpha"> <li><input...