php

PHP devs that moved to Python, is the experience better?

Hi! I'm planning on moving to Python and I have a couple of additional questions along with the title: did you have more fun with python? are you as productive as when you're using PHP? what made you change to python? Would you do a project again in PHP? If so, why? Your answers would really be useful for us PHP devs wanting somethin...

Which problem do we face after switching from PHP 4.0 into PHP 5.3.3?

As we all know yesterday PHP released new version of 5.3.3. My question is following: What kind of possible problems could we have if we update PHP 4.0 into up to date 5.3.3.? I mean were their any functions or operators on PHP 4.0 that don't work on PHP 5.3.3. and kind of such a problems? That's it. Thank you. ...

How do I avoid having to go two levels deep in CodeIgniter before I can parse URL segments?

Hi. I'm developing a game fansite to learn CodeIgniter that includes a database of character information. I want to use this URL format: http://www.mydomain.com/characters/joe http://www.mydomain.com/characters/sam So I have a controller called characters. If I understand the CI documentation, I can only parse "joe" and "sam" in t...

does any one see how i can make this more effiecient?

so my code works but its not very fast when i have a $id with a large amount of applicationID's and im afraid that that table will just grow and grow. $x = '0'; $y = '0'; $query0 = "SELECT applicationID FROM app WHERE schoolID='$id'"; $result0 = mysql_db_query($aidDB, $query0, $connection); while ($r0 = mysql_fetch_array($result0...

Strip out special characters

Hello all, I pull some data from a HTML page with a list of products and for some text it looks like this: Organicâ„¢ In the HTML page when I look at that same text I can see its supposed to read Organic with the TM (Trade Mark) symbol after it. Why does it look like the above! My main question is How can I get rid of TM, @ and C...

PHP - get last week number in year.

Hello! Tell me please how to get the last number of weeks in a year? ...

Remove duplicate elements off a multi-dimension array in php

Hay guys, i have an array contain this data Array ( [id] => Array ( [0] => 1 [1] => 10 [2] => 4 ) [age] => Array ( [0] => 1 [1] => 1 [2] => 2 ) ) Now i want to remove duplicates from the ['age'] and leave the first one ...

SwiftMailer problem

I use SwiftMailer in my PHP script to send emails upon HTML form submission. On the test server it all works fine. On the production server (different host) it gives me this error message: Parse error: syntax error, unexpected T_CLASS in /home/alkal5/public_html/html/swift-mailer/lib/classes/Swift.php on line 18 What could it...

PHP image resizing not working. Is there a file size limit?

I'm using a simple image manager class, and the following code: <?php include('SimpleImage.php'); $image = new SimpleImage(); $image->load($target_path); if($image->getWidth() > 500) { $image->resizeToWidth(500); echo "<p>Image Resized</p>"; } else echo "<p>Image did not need to be resized.</p>"; $image->save($target_path); echo...

How to put letters into a sendmail queue using PHP

I want to put letters into a queue instead of sending them instantly. Also, I need to track when letters are sent. I have this basic newsletter system, so before sending a letter I need to give each letter a sender ID (the newsletter user account ID) so I could track specifically what user has still letters pending to be sent. How could ...

checkbox state should retain state to hide/unhide text on pageload

as a follow up to this question, while the checkbox value is stored on pageload, the text is displayed on pageload, even if the checkbox is unchecked. the text should hide/display only if the user has unchecked/checked the checkbox, throughout the session or till he closes the browser. js code which stores the checkbox state: functio...

Why is PHP apt for high-traffic websites?

I was surprised to learn today that PHP is used widely in high-traffic websites. I always thought that PHP is not strong in terms of performance, being a dynamic, scripting language (e.g. compared to statically typed, compiled language like C/Java/C# etc.). So how come it performs so well? ...

How define a unique "plugins" path to all apps in 1.3?

In 1.2 i used: $pluginPaths = array(CAKE_CORE_INCLUDE_PATH . DS. 'vendors' . DS. 'plugins' . DS); But.. in 1.3 we have the new plugins path, and i believe thats not necessary the $pluginsPaths manual declaration if i have: if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define('CAKE_CORE_INCLUDE_PATH', ROOT); ...

Is it a bad practice to write HTML markup using only PHP echo statements?

There is a guy at work that pretty much writes all of his html markup by using echo statements. It looks really clean and I like it a lot, but I remember hearing it is a bad practice considering it becomes a little much when you have to write large quantities of markup. What is the best practice? ...

PHP > Zend Framework > Zend_Money

Hi I've used Zend_Money to format currency as follow $currency = new Zend_Currency(array('value' => $money, 'currency' => 'CAN', 'format' => 'fr')); // output -> 100,00 $ Which display normally on my local development system (wamp on windows) But when i put it...

What's a good way to handle post data in Codeigniter?

I.e. would you recommend me to use one controller method like this: function save() { if(!is_bool($this->input->post('')) { $post_data = $this->input->post(''); $this->mymodel->save($post_data); } $this->load->view('myview'); } Or would you recommend writing it using two methods? function save() { ...

How to order (sort) a numeric value using simpleXML and PHP

I am extracting data from an XML Engine using simplexml, and I am completely stuck when I try to oder ASC or DESC the data. Be aware that I am not writing this values myself, but I am extracting them from another source. Ive got another response to a similiar question and I had this as an example (which works): $d = new SimpleXMLEle...

PDO and Microsoft SQL: Must declare the table variable "@P1"

I'm trying to use binding in PDO to select some entries from a Microsoft SQL database. The code I'm using looks like it's similar to what I've found in the documentation. However, when I run it, I get the warning below: Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[42000]: Syntax error or access violation: 1087 [M...

How to display custom fields of a subpages on a parent page in WP?

How would i show let's say two custom fields from the subpages on a parent page. Here's my code so far: <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?> How would i show two custom fields titles "details6" and "details7" ...

File downloads incomplete over slow connection

I have a 15MB file on a website (Apache webserver) that downloads fine on reasonable speed connections, but is almost always incomplete on slower connections (28KBytes/sec, for example). The size of the incomplete file is random, from 2 to 13 MB. I have verified the behavior in both Safari and Firefox, on a connection with negligible l...