php5

PHP: Implementing the SeekableIterator interface...

I'm currently writing a class that implements the SeekableIterator interface and have run into a problem. I have two internal arrays that I am using and would like to allow for iteration through both of them from outside the class. Is there an easy way to do this without first merging the two arrays within the class? Here's a quick exam...

PHP Readonly Properties?

In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess truly readonly properties. For example, I can read the $nodeName property of a DOMNode, but I cannot write to it (if I do PHP throws a fatal error). How can I create readonly properties of my own in PHP? ...

How Can I Write Zend Framework URLs That Have Anchor Tags In The Body?

Using the standard MVC set up in Zend Framework, I want to be able to display pages that have anchors throughout. Right now I'm just adding a meaningless parameter with the '#anchor' that I want inside the .phtml file. <?= $this->url(array( 'controller'=>'my.controller', 'action'=>'my.action', 'anchor'=>'#myanchor' )); Thi...

How do I connect a database to a website so that the user can access the database and make changes to it?

I am trying to make a website that allows the user to make changes to their individual mysql database. The website is written in PHP. How do I connect one of the web pages to a database? Any advice would be appreciated. ...

How do I connect to my mysql databases, which I used heidsql to make, from a website?

I am using heidisql to create my mysql databases. How do i connect to those databases from the website I'm using. I need to be able to change the databases from the website. I am writing the website in php and writing the program that interacts with the databases in python. Can anyone help me? Thanks ...

Zend_Form - Array based elements?

Using Zend_Form, how would I create form elements like this: <input type="text" name="element[1]" value="" /> <input type="text" name="element[2]" value="" /> // etc... ...

Cyrillic characters in PHP's json_encode

I'm trying to encode Cyrillic UTF-8 array to JSON string using php's function json_encode. The sample code looks like this: <?php $arr = array( 'едно' => 'първи', 'две' => 'втори' ); $str = json_encode($arr); echo $str; ?> It works fine but the result of the script is represented as:...

Zend Framework problem with URL mapping.

I'm trying to map an action to the base URL and default controller. Swear this should be straight forward or even an 'out the box' feature but how do you map actions in your default controller to the base url using the Zend Framework? I'm fairly new to the Framework so I'm hoping I'm just missing something obvious. Trying to map: doma...

Is there any API to integrate with English dictionary in PHP ?

Is this possible to Integrate with any English Dictionary, so that every word entered in my text-box should be cross checked from the Dictionary and return me true/false. ...

Optimizing PHP string concatenation

Hello there, This post is not really a question, but it could be useful to share some coding tips. Here is the one I'de like to share with you. I'm gonna show you 4 examples to do the same thing, but only the last one will be the best. $foo = 'John SMITH'; echo "Hello $foo, welcome on my website."; echo "Hello " . $foo . " welcome o...

What is the best/fastest MySQL Table Schema for temporary/rotating storage, e.g. for session management?

When it comes to writing custom MySQL database-driven PHP session management for a VERY dynamic website, what is the best (fastest read/write access) structure for your session table? Bad Example (Not Optimized): CREATE TABLE `session` ( `session_id` VARCHAR(32) NOT NULL, `session_data` TEXT NOT NULL, `t_created` DATETIME ...

how could I write as a static page in php dynamic content?

I have certain user information that they are willing to make public and searchable. I'm thinking ala LinkedIn these should be generated static-pages that reside on our server with a fixed URL. What, technically, is the recommended way to do this? Here is the use case: a user indicates that he has contacts at an account, say, Gymboree...

Zend Framework with multiple schema/databases?

I have a few tables that I've defined like the below examples: class TableA extends Zend_Db_Table_Abstract { protected $_schema = 'schema1'; protected $_name = 'tablea'; } class TableB extends Zend_Db_Table_Abstract { protected $_schema = 'schema2'; protected $_name = 'tableb'; } ...

How to create a MySQL stored procedure from PHP ?

My attempts to query MySQL from PHP with a create statement of a store procedure (SP) have all failed. Is this not possible ? If indeed possible, please give an example. ...

Validate sprintf format from input field with regex

I have an input field where both regular text and sprintf tags can be entered. Example: some text here. %1$s done %2$d times How do I validate the sprintf parts so its not possible them wrong like %$1s ? The text is utf8 and as far as i know regex only match latin1 characters. www.regular-expressions.info doesnt list /u anywhere, which...

PHP5: Some Session files 0 length?

Hi folks, I'm seeing a strange situation, that I'm trying to figure out if it's a PHP issue, file issue, or normal operation. I have some users complaining about very fast timeouts on our site (session expires?), and checking the php tmp directory, I see things like this: -rw------- 1 www-data www-data 377 2009-01-15 22:46 sess_fc789...

SWIG for making PHP extensions, have you tried it?

I have a few small libraries and wrappers written in C (not C++) that I would like to make available to PHP via extensions. I read several tutorials on writing proper PHP extensions and it does not seem to difficult, however I don't want the hassle of maintaining the extensions in addition to the libraries. I read that SWIG supports bui...

How to use nested table for html to pdf converter using php?

i can't convert the nested table html coding into pdf . hpw to use the nested table for converting the html to pdf. for the following example i need solutions: Data1 Sub Data1 Sub Data2 ...

PHP5 sqli bind_param problem with binding boolean values

Hi, I have a problem binding booleans using mysqli_stmt::bind_param in PHP5. The SQL query is the following: insert into nvp_notes (subject,messageid,receivedate,read) values (?,?,?,?) Where 'read' is a tinyint, either 0 or 1, as I've had issues with bit using mysqli. So the types that I list in bind_param are: $stmt->bind_param('sds...

Extension PHP5 does not parse in XAMPP

Hello, I've installed XAMPP Apache server and put my website into htdocs. I've started Apache server. On my website I've got files with extension PHP and with extension PHP5.The difference is that when I type in into browser localhost/file.php - I see a parsed website. But when I type localhost/file.php5 (i have this file on server), t...