php

How to get a list of product categories and their ID's from Magento?

I'm trying to import a large number of products from a DB into Magento. The DB has many different product categories, which I've recreated within Magento. However, when importing the products via a CSV, you must list the category ID rather than the name. Is there any way to bring up a list like the following: id | category 1 | pies 2 | ...

Strange x & y POST values being sent in form

What are these x & y values that are being sent back with seemingly random values? After submitting my form, I output the _POST array using print_r() to make sure my form is being submitted properly. Array ( [user] => Richard Testani [pass] => sdf [client] => Kim Ronemus Design [api] => 3425yrt [email] => [email protected] ...

How to to sort a XML feed with SimpleXML

Hi, I have started to use the simplexml function that seems to work out better than the previous other parser that I have tried to use. I have got to the stage where I need to the sort the items by transmissiondate - I tried using the uasort but does not make any changes the order of the items. also some times a programme is on more t...

Why do WAMP apache try to load a module from php 5.2.8 ext dir, while its configured to use php 5.3.0?

I have a wamp installation on a vista machine ... This wamp is running Apache 2.2.11, Php 5.3.0, and mysql 5.051b Ther is another php 5.2.8 installation. I use nusphere phped 5.9 as php ide. For debugging i use dbg. I copied the dbg for php 5.3 dll to php 5.3 installations ext dir. I can use dbg from nusphere just fine. But recently...

Strategies for level/tier based frameworks

Currently I have a legacy based non-MVC php framework which I need to update to support a leveling/feature system. I want to have two modes, a normal mode ( the current mode ) and a level based mode where I control what features are included - low, medium, high tiers. For example, the low tier will not support google maps, while the m...

determine the http status that will be sent in php

I am trying to write a test case for a class that is managing headers for my application. Among the headers it sends are http status headers. I am using headers_list() to see which headers would be send, were I to send headers now. The problem with headers_list() is that it does not include the http status header (although this seems to ...

using regex to get extract username from email address

My string of text looks like this [email protected] (John Doe) I need to get just the part before the @ and nothing else. The text is coming from a simple xml object if that matters any. The code i ahve looks like this $authorpre = $key->{"author"}; $re1='((?:[a-z][a-z]+))'; if ($c=preg_match_all ("/".$re1."/is", $authorpre, $matc...

php regex - checking for two possible string literals values in an expression

I am using php preg_match and I have the original expression as: |(label\">Carried Price </span> £)((.)*?)( </div)| But I want to be able to able to be able to use the same basic expression but be able to search for Carried Price or Web Exclusive. I tried something like: |(label\">[Carried Price|Web Exclusive] </span> £)((.)*?)...

Problem with caching (maybe) when using AJAX and PHP

Hi Firstly I tried fiding some similar posts but could not quite find anything. Mainly because I see this problem in FF and not IE only. I had a web page that was updating a mysql db no problem with some data. Then today, I switched the way it does this so that I can use an ID instead of a value, so for sizes, instead of small, medium ...

Variable type hinting in Netbeans (PHP)

Just curious if there's a way in netbeans to give type hints for regular variables, so that intellisense picks it up. I know you can do it for class properties, function parameters, return types, etc. but I can't figure out how to do it for regular variables. It's something that would really help in situations where you have a method tha...

From a usage standpoint, what's the difference between a private and protection class function?

I know the manual definition, but from a real life usage standpoint, what's the difference? When would you use one over the other? ...

How to serve multipart/related content in PHP?

Say, I have an application/xhtml+xml content and a gif image. How can I serve (not render) these two in a single http get request (using PHP)? It should be a multipart/related content. After reading this RFC, I tried something; but it did not work. (No, I am not trying to send emails with attachment) Thanks in advance. EDIT: Finally I ...

How to execute a hyperlink automatically through php

I had a hyperlink like this http://www.mywebsite.com/sendmessage.php?uid=siva&amp;pwd=mani&amp;phone=newairtel&amp;msg=dg Normally in HTML we put href to that link and the link will open after the user click that link. But I want that link to be executed automatically without user interaction using PHP. How can i get it. Plz help. An...

PHP calculation

I'm trying to output a value from xml this is what I do - <?php echo $responseTemp->Items->Item->CustomerReviews->AverageRating; ?> This outputs 4.5, but when I change it to the code below it displays as 8. Why isn't it displaying as 9? Thanks. <?php echo $responseTemp->Items->Item->CustomerReviews->AverageRating*2; ?> ...

replace any url's within a string of text, to clickable links with php

Say i have a string of text such as $text = "Hello world, be sure to visit http://whatever.com today"; how can i (probably using regex) insert the anchor tags for the link (showing the link itself as the link text) ? ...

Why does the Zend framework prepend an underscore here?

What's the point of having $_comment instead of $comment? class Default_Model_Guestbook { protected $_comment; protected $_created; protected $_email; protected $_id; protected $_mapper; ...

Getting the output in Array Collection.

/* [Bindable] public var rows1:ArrayCollection=new ArrayCollection([ ['Google', [{Projectname:"1", Client:0}, {Projectname:"2", Client:1}, {Projectname:"3", Client:2}, {Projectname:"4", Client:3}] ], ['Yahoo', [{Projectname:"1", Client:4}, ...

Large String while during POST ignores the letters after space

I had a textarea, when i post that content in textarea, I only get only first word before a space is given. For example if my value in textarea is 'He is mad man', i get only 'He'. plz Help me to sort out this problem; Code: <form name="SendSMS" method="post" action="admin_main.php"> <div class="reg_item">Category </di...

Unable to catch exception

Why doesn't the following print "Error!" but only prints the 'failed to open stream...' warning? try { file_get_contents('www.invalid-url.com'); } catch (Exception $e) { echo 'Error!'; } ...

Why am I getting supplied argument is not a valid MySQL result resource error

I am trying to display blogs on a certain page here is my code: <?php $query = "SELECT * FROM `Blogs` WHERE `Author` = '".$prof->id."' && `id` != '" . mysql_real_escape_string($_GET['id']) . "' && `status` = 'active' LIMIT 6" && "ORDER BY `date` DESC, `time` DESC "; $request = mysql_query($query,$connection); while($result = mysql_fet...