php

diacritics problem in project made with Zend Framework

Hi, found a interesting problem during testing our web application. I have application on localhost (Windows) and online testing server (Linux). Both are connected to same DB (on Linux server). When I tried to edit one text field through form in application located on Linux server it crop diacritics from result and save it to DB witho...

Where should I start with a facebook application?

Hi all. I am thinking about developing a fairly simple facebook application which i have modelled the database in access. I have web space and mySQL databases available, but I was wondering if anyone could point me towards any guides for facebook development? I had a search a while back, but they all seemed rather out of date. Anyone kno...

webpage title

Hi In My Website I have main urls such as h**p://www.sy-stu.com/stu/music.php The Title of the page is Syrian Students ... Music Center But when i get into the subpages such as h**p://www.sy-stu.com/stu/music.php?module=MusicServer&page=browse&ViewType=Albums&Artistid=305 The Title still the same how can i modify it to show someth...

Rewrite rule not working

I've done the first steps in Zend Framework with akrabat.com/zend-framework-tutorial/. The Demo-App works fine, but the CSS. I think my rewrite rules are wrong. All hrefs looks like: /~cm/zf-tutorial/public/index.php/index/edit/id/1 /~cm/zf-tutorial/public/index.php/css/site.css The .htaccess is: RewriteEngine On RewriteCond %{REQU...

How do you search zipcodes using Zend Lucene?

I have very simple company index with Zend Lucene using this to create the index: // store company primary key to identify it in the search results $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId())); // index company fields $doc->addField(Zend_Search_Lucene_Field::Unstored('zipcode', $this->getZipcode(), 'utf-8'));...

Using MySQL Databases and PHP to Populate forms.

I am contemplating taking the next step with my PHP applications and making the option fields dynamic. That would open the doors for more automation. I have drop downs throughout my project, they are used to select a specific user and I update them manually when a new user is added (which is also a manual process). But if i take the fi...

PHP echo performance

I'm always using an output variable in PHP where I gather all the content before I echo it. Then I read somewhere (I don't remember where, though) that you get best performance if you split the output variable into packets and then echo each packet instead of the whole output variable. How is it really? ...

PHP CLI: reading a line from a socket and stripping telnet control characters

I want to read a line (ending with \x0D\x0A) from a PHP socket, and strip the telnet control charaters (IAC, WILL, DO, etc) from it. Currently I'm using this: <?php // snip function socket_readline($socket, $echo = true) { $buffer = ""; $bufsize = 0; $length = 4096; $need = $length; while ($bufsize < $length) { ...

Opening page with tab preselected that's not the first tab

I have a page with a jqueryui tabset on it. I'd like to be able to open the page with tab other than the first tab selected. If I have four tabs on the page I need to be able to select any of the four to be the 'open' tab. This maybe a link from another page or a link from a page in the same frameset. Under the covers everything is P...

PHP clone keyword vs clone() command line CLI issues

Hello, I have been using the clone keyword to duplicate objects like so: $x = clone $obj; as per the manual. This works fine when accessed by browser. phpinfo() reports PHP version 5.2.6. However when run by cron or from the CLI I get "Parse error: syntax error, unexpected T_VARIABLE" from the clone keyword. php -v reports P...

how to divide a long article and store in the database for easy retrieval and with paging?

Suppose it is a long article (say 100,000 words), and I need to write a PHP file to display page 1, 2, or page 38 of the article, by display.php?page=38 but the number of words for each page can change over time (for example, right now if it is 500 words per page, but next month, we can change it to 300 words per page easily). What i...

Secure directory password protection without .htaccess

Hi, I was going to use .htaccess to password protect a directory for a php script I'm writing, as I do not trust my PHP skills to create a secure login, but I found out you cannot use relative paths for AuthUserFile and I could not generalize this. If you could direct me to a secure PHP login script to password protect a directory I wou...

What's the ideal way to implement this PHP/XML function in a website?

Hi, I have this code written up to snatch some weather data and make it available on my website: if( ! $xml = simplexml_load_file('http://www.weather.gov/data/current_obs/KBED.xml') ) { echo 'unable to load XML file'; } else { $temp = $xml->temp_f.' Degrees'; $wind = $xml->wind_mph; $wind_dir = $xml->wind_dir; $gust =...

Try catch statements in PHP

Hey everyone, Im quite new to programming so please be nice :) I am currently experimenting with try-catch statements, I read the documentation on the php.net website and didn't find it all that helpful. I understand what they do, but from reading it, i would not be able to implement one into my own code. I need a real example to help m...

how to find all occurences of a certain character in PHP?

the most efficient way? ...

Drupal node_save no longer returns $nid, so how do I get it?

I have code like this: ... setup $issue object ... $node = node_save($issue); print_r($node); The node is created successfully, and everything works fine...but nothing it returned from save_node(). Older docs indicate that it returns $nid. Several discussions and tickets indicate that in recent Drupal versions the node object is re...

PHP - how to best determine if the current invocation is from CLI or web server?

I need to determine whether the current invocation of PHP is from the command line (CLI) or from the web server (in my case, Apache with mod_php). Any recommended methods? ...

how do i write my script to output data where i place something like this: {name}

i have seen many scripts where you'll see something like this <meta keyword="{keywords}" ...> or <input type="text" name="name" value="{name}"> what is this called and how can i do this myself. thanks ...

How can I write a SQL count with group by clause using Propel ORM in Symfony?

How can I write the following SQL query using the Propel ORM? SELECT species, COUNT(*) FROM Bird GROUP BY species; ...

how to read output of var_export into a variable in PHP?

the output is like below restored in a output.txt file: array ( 'IMType' => '1', 'Email' => '[email protected]', 'SignupName' => 'test11', 'Password' => '11111', 'Encrypted' => '', 'Confirm' => '11111', 'OldPassword' => '', 'Name' => 'test', 'SignupProvinceText' => 'province', 'SignupCity' => 'cityname', 'Street' => '...