php

Adding User-specific classes dynamically

I noticed that some wordpress themes ('Thematic' for example) adds user specific classes to the body element so you don't have to retort to CSS browser hacks, for example: wordpress y2010 m02 d26 h05 home singular slug-home page pageid-94 page-author-admin page-comments-open page-pings-open page-template page-template-home-php mac firef...

PHP send plain text mail and force fixed-width charset

I want to force the reader's email client to display my php-generated plain text emails with a fixed width charset. Thunderbird displays the email with a fixed width charset. However, Gmail and Outlook (and probably more clients) do not. Is this a config setting with my mail server or something I'm doing wrong? Any help would be great...

How can I fetch the entire tree in a single query with doctrine?

This snippet from official website works as expected: $treeObject = Doctrine::getTable('Category')->getTree(); $rootColumnName = $treeObject->getAttribute('rootColumnName'); foreach ($treeObject->fetchRoots() as $root) { $options = array( 'root_id' => $root->$rootColumnName ); foreach($treeObject->fetchTree($options) as $no...

Question about a files array and mime types

I need to make a script that will take files from a user and upload them to a server. I've already done this one and on my first attempt, I built in some checking to ensure that the correct mime type was being uploaded. Today, I have learned that browsers interpret mime types differently. This makes me think that maybe it isn't worth che...

Facing problem working with PDO for mySQL

while using the following constructor $this->pdo = new PDO ($this->source, $this->username, $this->password); if I do not have any password then should I pass a NuLL value for creating a new instance of PDO? ...

How I can create doc file from php file.

I have a resume building site. In which user input their information and finally we need to create his resume in doc or pdf file. Anyone help me please... ...

What is the feature you want the most in PHP6

PHP5 has made a real progress, but there's still some lacks, and before all a big mess, in PHP5. What is the feature you want the most in PHP6? Some ideas : method overloading in classes variables types in method declarations (not only classes, but basic types as well) multiple heritage unicode cleaning the PHP function mess Friend c...

finfo path not found

I'm on 5.3.1 and after reading the docs, I see that fileinfo is included and that pecl is no longer required. I an however getting: finfo_file(): File or path not found I'm not sure what it's looking for. I've enabled the extension in the ini file and attempted to run the example from the PHP site: $finfo = finfo_open(FILEINFO_MIM...

Jquery ajax hash return page fragment

Hi, I have an application with URLs like this: domain.com/category1/category2/ etc. I see that ajax understands the # and can pass the params to my php script. I am wondering if there is a way in ajax to do the following URL: domain.com/#category1/category2/ If so, is there a function that I can use in jquery to do this? I have seen...

Search mysql database using php

Hello! I want to implement a powerful search engine for my ecommerce application. im using php and mysql as database. Can anyone guide me how to proceed? Is the FULL TEXT feature of MYSQL good for a large volume of data? Thanks! ...

php file got executed by alexa crawler and caused problems!!

I've wrote a script that will be used to release the new pages automatically at a particular time. It will just show a countdown timer and then when it reaches 0 it will rename a particular file into index.php and renames the current index.php to index-modified.php There's no problem in this. But at some point time my customer told tha...

Chmod, php and imageupload

What is the best practice when it comes to image upload using PHP? How should I handle the chmod settings? Example; I have a dir called /image/ where i want to upload all my images. Should I set this dir to chmod 777 and leave it like that? Or should i change chmod on that folder via PHP each time I need to upload a image. What is bes...

yes no bar using php

Hi below is my yes or no BAR, For bar i have three image.. image_left is left side curve image, image_center is the center square image image right is right side curve image, This below is my php function , am just increasing the center square image width , no other extra stuff i did for bar graph function recommend_chart_yes_no($...

how to generate slugs in php

hey guys im trying to write a script , that can rewrites urls in slug way such as this : http://www.mysite.com/mystorytitle/ and i did this in my codes : RewriteRule ^(.*)\/$ app=News&file=article&title=$1 [L] and in my php codes, i created a slug out of story's title as : $slug_title = mysql_real_escape_string($mtitle); ...

jquery - select all checkboxes with js array name

Hey, I want to use a JQuery "check all" function in a form like this: http://jetlogs.org/jquery/jquery_select_all.html My problem is I am generating my form from a php script, and I don't know exactly how many checkboxes I will have in advance. I use the "array" naming convention to be able to get all the selected checkbox values in m...

<tbody> glitch in PHP Simple HTML DOM parser

I'm using PHP Simple HTML DOM Parser to scrape some data of a webshop (also running XAMPP 1.7.2 with PHP5.3.0), and I'm running into problems with <tbody> tag. The structure of the table is, essentialy (details aren't really that important): <table> <thead> <!--text here--> </thead> <tbody> <!--text here--> </tbody> </ta...

Memory leak with preg_replace

I'm using the preg_replace function to replace accents in a string, I'm working with UTF-8. I have incurred in what seems to be a memory leak, but I can't isolate the root cause, my code is rather simple: preg_replace( array_keys($aToNoAccents), array_values($aToNoAccents), $sText ); where $aToNoAccent...

Displaying a Blob back as a Image in php without header("Content-type: image/jpg");

Im pulling the binary data out of my mySql database and want to display it as a image. I do not want to make a separate page for it to display the image (this would involve a extra call to the databae among other things) I simply want to be able to do Pretty much but the $Image variable is in its longblob format and I need to conve...

find part of a word and then replace the whole word with a string

so if i have the text: "this is going to be really great" and i have the needle "goi" i want it to find going and then replace it with the link <a href="http://wwww.something.com/going"&gt;going&lt;/a&gt; can you help me? i am really bad in regex ...

Limit of POST arguments in html or php

Hi, is there any limit of POST arguments? I have situation where on dev server my form with over 520 args is posted and saved without problems, where on production env it saves only up to 499 args... Any ideas? ...