php

how to convert json to string

how do i convert a json object to a string i want to insert a json object to a mysql DB ...

php cookies problem

hello sir.. i just want to ask if do i need to set something to enable the cookies from my hosting? i have this <?php setcookie("TestCookie","Hello",time()+3600); print_r($_COOKIE); ?> it will function perfectly at my server which is xampp. but when i upload it to my hosting, it will not function.. what should i do? or what will ...

php image upload problem with move_uploaded_file function

i have one image upload script which upload same image on two locations same time with move_uploaded_file() function like this $fpath="../p/e/".$prop_fac1; $error = move_uploaded_file($tmp_name, $fpath); $fpath1="../p/t/".$prop_fac1; $error1 = move_uploaded_file($tmp_name, $fpath1); the problem is, first part works mean it u...

How do i truncate a post (HTML/Markdown) but not give invalid markup

is there a way i can truncate a post. eg. create a blog summary. while not breaking the markup? 1st i am thinking of HTML if that can be done, how do i work on markdown posts i use PHP/Zend Framework/MySQL/Doctrine2 ...

Functions outside the class

I just want to tell you that I am newbie to OOP and it is quite hard to me, but here is my code: class functions { function safe_query($string) { $string = mysql_escape_string(htmlspecialchars($string)); return $string; } } class info { public $text; function infos($value) { echo func...

class variable is reset each request

i hava a class that hold a list for each request but each request the list is empty again what can i do to make it live here is my class , i want the list to hold values from previews requests (yes each request i'm settings a value there ) class Sessions{ private static $list = array(); .... ..... } ...

PHP OOP working with a hierarchy of objects

Hi everyone, I have a Site object but I can't figure out how best to store a collection of Page objects on Site. The pages are hierarchical (a tree structure for a website navigation). I thought about a tree-like array of pages but that would be a pain to interact with - e.g. $site->pages[0][3][1]->addContent('<h1>lol</h1>'). I could us...

PHP for each issue

Hey all, I am using the foreach function to get all the categories for a WordPress site and need a way to adjust the output if there is another tag, to include dynamic CSS. Basically, if I have only one tag I need the code output to look like this: .category-wordpress #wordpress { background: #FFFFFF; color: #232323; text-decoration: ...

unable to bind address [0]: php error .

unable to bind address [0]: Only one usage of each socket address (protocol/network address/port) is normally permitted.... error is given by my php server page. I tried different port numbers as looking from cmd as writing netstat -an. Also I searched on google but no solution. I am using wamp server and working local . Thanks . <?ph...

Magento E-bay Integration

Hi, Please help, I need to integrate all the products and category of ebay in my magento store, do any one have script or idea how to do this ..? Thanks, Jeet.... ...

A scalable solution for server side push?

I would like to implement a mechanism which will provide a RESTful API that allows a client to register interest in a subject with a sever, and receive asynchronous notifications from the server after the interest is registered. In enterprise (messaging) architecture, this is known as publish/subscribe 'pattern'. With desktop applicatio...

Unicode characters become question marks after inserting into database

When I insert some text written in unicode into database, they become question marks. Database encoding is set to utf-8. What else may be incorrect? When I check in phpmyadmin there are question marks inserted only! This is the code I use for connecting to database: define ("DB_HOST", "localhost"); // set database host define ("DB_USER...

Setting session_id unreliable when using flash to send data

I'm using PHP version 5.3.2 on both my local development server and remote web server. I'm trying to use uploadify to upload several files to the server. In the receiving script, I would like to use data stored in the session, however because uploadify sends files to the script using flash it doesn't send the session cookie. The workar...

alert for new update in php or javascript

How to change background color for last render row in while loop .... that is row1 row2 **row3** If row4 is added then it should row1 row2 row3 **row4** that is star represents some bgcolor red... this loop am following,,,, $i = 1; while ($row = mysql_fetch_assoc($sql)) { $out_data[] = "<p>$i {$row['news']} </p>"; $i...

Drupal: Edit email template from contact form

When submitting a message in my site-wide contact form in Drupal 6.x I get the following message along the top of every message: [Name] sent a message using the contact form at [www.mysite.com/contact] I would like to remove this message. Looking around, I've found it comes from the contact.module here: $message['body'][] = t("!name ...

Google Chrome audit on caching

If I run an audit on my sites with Google Chrome, I get this message in the Leverage browser caching section: The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers: A list of all the pictures follows. I get a similar notice in Leverage proxy caching: ...

Save Google map to jpeg using PHP?

Is it even possible? I am implementing an export to pdf functionality for a pile of data, one of which is a Google map with a marker. Thank you. ...

in PHP, how to check if the date_create return an valid date object?

date_create('sdfsdfdsfsd') //invalid date_create('2010-07-30 08:03') //valid ...

Sorting array of dates stored in a string

Is there away i can sort the following array into the correct order? Array ( [0] => apr [1] => aug [2] => dec [3] => feb [4] => jan [5] => jul [6] => jun [7] => mar [8] => may [9] => nov [10] => oct [11] => sep ) NOTE The array comes to me like this, and sometimes it will not have all th...

Get class constructor

how to get a class constructor function name without instantiating the class? example: $class = 'someClass'; $constructor = somehow get constructor; $args = array(); $object = call_user_func_array(array($class,$constructor),$args); what I need is to create a object by passing a undetermined number of variables into it's constructor....