php

Optimizing big import in php

Dear SO: I have a simple importer, it goes through each line of a rather big csv and imports it to the database. My question is: Should I call another method to insert each object (generating a DO and telling it's mapper to insert) or should I hardcode the insert process in the import method, duplicating the code? I know the elegant th...

PHP: How to get rid of all <![CDATA[ and ]]> occurrences in a string?

I tried this as a test: <?php $crap = "<![CDATA[Hello, world!]]>"; $crap = str_replace(list("<![CDATA[", "]]>"), "", $crap); echo $crap; ?> But it returned this: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ')' in /srv/www/htdocs/test.php on line 3 ...

How stable is APC 3.1.x?

Is anyone using APC 3.1.x in production on a high volume site? The 3.1 series is labeled a "beta" release, but it has some features that we'd really like to have (specifically, performance improvements for apc_clear_cache('user') which didn't make 3.0.19) So: are you successfully using APC 3.1.x on a very active site? (more than 1 PHP ...

Dynamic drop down list!

I have edited the question as what I said before was two pieces of code together. I have the following code: $f = "SELECT * FROM ".TBL_FIXTURES." WHERE compname = '$_POST[league]' AND home_user = '$_SESSION[username]' ORDER BY away_user"; $fixtures = mysql_query($f); ?> <? while( $row = mysql_fetch_assoc($fixtu...

How to get bootstrap resource in front controller plugin [Zend Framework]

protected function _initDatabase() { $params = array( 'host' => '', 'username' => '', 'password' => '', 'dbname' => '', ); $database = Zend_Db::factory('PDO_MYSQL', $params); $database->getConnection(); return $database; } . class App_Controller_Plugin_Tes...

Is [manipulating Craigslist postings with PHP] possible?

Hey everyone, I have a quick question. I want to build a web app for myself that will allow me to post stuff to Craigslist and retrieve postings from Craigslists. I am not doing this to spam Craigslist, I am just doing it to learn. My question is: Is this possible? If so, will knowing PHP be enough? Or will I also need to know how to use...

php SimpleXMLElement set text

how to set text for a SimpleXMLElement in php? ...

PHP: How to handle <![CDATA[ with SimpleXMLElement?

I noticed that when using SimpleXMLElement on a document that contains those CDATA tags, the content is always NULL. How do I fix this? Also, sorry for spamming about XML here. I have been trying to get an XML based script to work for several hours now... <content><![CDATA[Hello, world!]]></content> I tried the first hit on Google if...

gwt javascript checking php

i am using gwt. i need to check some input data. all checking functions are located in PHP server check.php i am not using javascript checking executed from locally. all i am doing is to send user input to server by ajax and validate in that place and error message comes from server to client's gwt widget. is it best approach?? i c...

How to display comments and their replies using PHP & MySQL.

I was wondering how can I display comments and their replies using PHP & MySQL. An example would help me out very much as I don't know how to do this. In particular, a visual example would be great and I can take it from there. Thanks! Here is my MySQL table. CREATE TABLE comments ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, parent_comme...

How to develop C extentions for PHP apps?

My PHP app has a number-crunching part that is just to slow for PHP, so I was thinking of building a custom C extention, but it is impossible to find any good reference to start with :( Is there a guide on how to do something like this? ...

Advice needed on JavaScript control libraries

I'm looking for advice/opinions on Javascript control libraries like ext-js, dhtmlx, jquery-UI etc... I've got some background in asp.net and have found the various 3rd party controls to really boost development time. I'm doing a project in PHP and have considered some PHP specific controls, however I suspect I would be better served l...

Cannot Access Zend Framework Libray through a PHP File?

I have kept the zend library in E:\wamp\www\Library\ this directory exists in the include_path inside php.ini of PHP and Apache both But whenever I am trying to use a class, it sends a error message that it cannot find the file ...

mysql_field_type differentiate between varchar and text

I need to get the datatype of a column, but both varchar and text datatypes both return the value 'string' under the mysql_field_type function in php. Is there a better, more specific method of checking a columns datatype? ...

Apache configuration files PHP library

Is there a PHP library that allows modification of the Apache configuration files from the PHP script? Thanks! ...

submitting radio values in a php form to a mysql table (UPDATING VALUE IN TABLE)

i am currently building a php form utilising the jquery iphone style radios (found at http://devgrow.com/iphone-style-switches/). by default the radio value is set to NO in the mysql table for every new entry. but i am having difficulty submitting the form. how will the form be able to tell the current status of the radio button (i.e. is...

Find array value using key

I would like to find the value in an array using the key. like this: $array=('us'=>'United', 'ca'=>'canada'); $key='ca'; How can i have the value 'canada'? thanks. ...

Find where a variable is defined in PHP (And/or SMARTY)?

I'm currently working on a very large project, and am under a lot of pressure to finish it soon, and I'm having a serious problem. The programmer who wrote this last defined variables in a very odd way - the config variables aren't all in the same file, they're spread out across the entire project of over 500 files and 100k+ lines of cod...

Passing object element to class not as a string (like constant) in php ?

How can I dynamically pass "items" to class function? For example here it is a piece of some class and its function where I declare an element of object (items) as $b: //.......... public function __add2SomeObj($b) { $namespc = $this -> __someObj(); // __someObj() returns object $namespc -> cats = $b; ...

How to echo out table rows from the db (php)

i want to echo out everything from a particular query. If echo $res I only get one of the strings. If I change the 2nd mysql_result argument I can get the 2nd, 2rd etc but what I want is all of them, echoed out one after the other. How can I turn a mysql result into something I can use? I tried: $query="SELECT * FROM MY_TABLE"; $res...