php

How to deal with m2m relationship(posts and tags) by doctrine(in symfony)?

posts and tags have a many-to-many relationship(pretty much like stackoverflow),so the code to do it without an ORM should be: $dml = "insert into posts(title,body,created) value($title,'{$_POST['post-text']}',now())"; mysql_query($dml,$con); $pid = mysql_insert_id($con); //deal with tags if(isset($_POST['tagnames'])) { $tags = preg_s...

Is it possible to enable an extension programmatically in PHP?

We can enable php_zip by uncomment it in php.ini as follows: ;extension=php_zip.dll How to do it programmably? I'm using PHP5.3 ...

I18n of Zend_Form values and errors

Hello, assume this situation $form->addElement('select', 'companies', array( 'disableTranslator' => true, 'label' => Zend_Registry::get('Zend_Translate')->_('companies'), 'filters' => array('Int'), 'required' => true, 'multiOptions' => array(1 => 'Company 1', 2 => 'Company 2') )); if($_POST...

Small regex question in PHP

Hi, I'm trying everything in a string BUT a certain pattern. My pattern is: $pattern = "/^[a-zA-Z0-9]+$/D"; And I want to do the following: $string = preg_replace(anything but $pattern, "", $string); How do I do that? Thanks! ...

mySQL table linking , group linked to other members lists, the displaying all members

I have a database with a group(g1) and a list of members(m1), by itself it works fine. However I want to add the ability of the group(g1) to add different groups(g2-3) to it's list so that a query would bring up ALL the members(M1)+(m2-3) as a result. My tables are: Group(1) Table: Group1, Member(2) table: MemberA, MemberB, MemberC...

Display an image in a <div>, jQuery

Hello, The value of ig is being transfered fine, but I need to put this image into an image, please tell me what I am doing wrong. var ig = '<img src='+$(this).attr('src')+' style="z-index:1">'; $('#big').val(this) Thanks Jean ...

proper Use of Indirect Reference

I have this indirect Reference i wonder what's the usage of this $name = "Air nike"; $$name = "Registered item"; print $AirNike; I was thinking to put save all the items that are registered in a document by date and I was thinking of this technique and wanted to make sure it was ok. What would be a good place to implement a technique...

How can I carry cookies in php to multiple subdomain

I want to carry some cookies value to different subdomains like blog.mydomain.com , profile.mydomain.com , stats.mydomain.com, etc. Right now I am using below code to set cookies setcookie('var_name', 'var_value', null, "/", '.mydomain.com' ); With this code, cookies set on blog.mydomain.com available on mydomain.com but not on oth...

Favourite Kohana Tips & Features?

Inspired from the other community wikis, I'm interested in hearing about the lesser known Kohana tips, tricks and features. Please, include only one tip per answer. Add Kohana versions if necessary. This a community wiki. ...

I'm at a loss what to read and study! Database design or Code Complete?

I've been a PHP programmer for 3 years. I really want to improve myself and I think reading more helps, but I'm confused where to concentrate next. I have two choices, read more about database design and advanced SQL or should I read Code Complete fully? ...

php/mysql creating duplicate records with multiple tables

I'm building a database for making hotel reservations. One table called "reservations" holds the general details of the reservation, while another called "rooms" holds details about specific rooms (each reservation has many rooms, each room belongs to only one reservation). I would like to be able to easily generate duplicate reservati...

Books for experienced .NET developer learning PHP/MySQL

Hi All, I am an experienced .NET developer (C#/ASP.NET) looking to broaden my skills to the PHP/MySQL arena. I would like get recommendations on books for learning PHP/MySQL that are geared towards someone who is already familiar with object oriented programming and web development. I do realize that there are lots of online material ou...

Making an half-disappeared element in CSS visible...

I've been trying many techniques.. but none helped. I tried "margin-bottom: 1em", "bottom: 2em", etc. but the element stays nearly invisible. See the bottom of the page.. there is a sentence, which is used to be shown.. Here's the URI: http://Sulayman.org/ Can anyone help me? - Thanks! ...

email script for xml control data

So I bought this image uploader program called q-imageuploader.The company doesn't help at all with scripts to let you know a file was uploaded and the index file that is created is rewritten every time a file is uploaded. I want to and/or make an email script that will let me know that a file has been uploaded, or modify the existing ...

php mcrypt - decrypting and encrypting files?

I've been looking around for a php class that allows the decryption / encryption of pgp-encrypted csv files. Everything I've found has been primarily geared towards passwords. I'm assuming the principles are essentially the same, but was wondering if someone here can point me in the direction of a class specifically intended to receive...

use DOMdocument to append elements in a XML-file?

i'm using the DOMdocument class in php whenever i want to create a XML document. but how could i open a XML document and add elements after an existing element in the XML document? its a very huge XML-document so it would be great to consider the most efficient way to do this. ...

Using memcache with PHP

I want to start using memcache with PHP (on Ubuntu 9.10). There are lots of info online which appear to show how to do this. Suprisingly though, none of the articles (I have seen so far), explicitly state whether you need to RUN the memcache process BEFORE attempting to use it or whether by simply calling new MemCache() via the PHP clien...

Php framework for fast developing

Please advise a php framework for fast developing and for don't digress to write often using code(auth, db/orm,etc..). Requrements: Active community Easy to use simple many to many and many to one relations auth. mechanism RoR like Please sorry for english. ...

How to calculate the square of (x + x2 + x4 + x5+x8) using FFT in PHP?

It's from this answer,which is said to be a nlgn algorithm. ...

What language are inbuilt PHP functions written in?

This may sound like a stupid question but I'm a beginner not just to PHP but to programming in general, so in that context: What language are inbuilt PHP functions written in? For example the inbuilt function "date("l")" when echoed will dislay the current day on the browser. But obviously this isn't done by magic, some one had to writ...