php

Publish news feed through cron job

Hello, It is possible to publish news feed on user's wall through a cron job, if yes then how, what does facebook offer to do that? ...

PHP uploads and checking

Hi all, Edited: Sorry for the inconvenience, when i look back the codes, it does not actually upload the files, it's only capture the file's info and store in the database, which later cannot be download by user coz there not exist such file anywhere... my questions is, how can i integrate this codes with move_uploaded_file() function?...

interact with an interface?

from what i've read it seems that one can interact with an interface? eg. lets say that i've got an interface with an empty method "eat()" then 2 subclasses are implementing this interface. can my controller interact with only the interface and use it's eat() method? have a look at the picture in this link strategy ...

Dynamic Object Initialization In JavaScript (just like PHP Reflection allows)?

Hi All, Using Reflection in PHP I can dynamically create a object like so $target = 'core_domain_Person'; $reflect = new ReflectionClass($target); $obj = $reflect->newInstance(); I would like to replicate this same concept in JavaScript is there a way to do this out of the box? Or is there a way to replicate what Reflection is doing?...

mysql_fetch_array() expects parameter 1 to be resource problem

I don't get it, I see no mistakes in this code but there is this error, please help: mysql_fetch_array() expects parameter 1 to be resource problem <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con...

php URI troube with if statement,

I am running an if statement, that looks like this, if($this->uri->segment(1) !== 'search' || $this->uri->segment(1) !== 'employment') { //dome something } My problem is that first condition works, if the uri segment 1 equals search then the method do not run however if I on the page employment, and the first segment of the uri i...

Sample codes for PHP Webservice

Hi Everybody, I am new to PHP,I need to create Webservices using PHP.Can anybody provide me the sample coding and the procedure steps to proceed? Thanks in Advance, Meena ...

PHP OOP: Avoid Singleton/Static Methods in Domain Model Pattern

I understand the importance of Dependency Injection and its role in Unit testing, which is why the following issue is giving me pause: One area where I struggle not to use the Singleton is the Identity Map/Unit of Work pattern (Which keeps tabs on Domain Object state). //Not actual code, but it should demonstrate the point class M...

Checkbox show error.

Hi, I need to make this show an error if the user tries to leave the page without checking this tickbox. It has no other use other than visual, is there a way to implement such a thing? <span> <input value="1" type="checkbox" name="salgsvilkar" ID="checkbox2" style="float:left;" onclick="document.getElementById('scrol...

How to send XML and other post parameters via cURL in PHP

Hello. I've used code below to send XML to my REST API. $xml_string_data contains proper XML, and it is passed well to mypi.php: //set POST variables $url = 'http://www.server.cu/mypi.php'; $fields = array( 'data'=>urlencode($xml_string_data) ); //url-ify the data for the POST $fields_st...

How can i embed a video player in moodle.?

1). i have some video files that will be played with the help of a video player. 2). i want to embed a video player in my script which will play these video files in moodle 1.9. 3). i can not upload those video files on some video hosting sites because those are copy protected. How can i achieve such functionality Please help Thanks...

mb_internal_encoding() not available though configured?

I'm having problem with mbstring in my Apache2.2/Win7/PHP5.3 setup, though I think it's correctly configured in my php.ini: extension_dir = "ext" extension=php_mbstring.dll I get the following: Fatal error: Call to undefined function mb_internal_encoding() in ... I did a manual installation (by the book) using the VC6 .zip. I'm run...

Uploading File Problem in PHP on Drupal

I don't know why but i had written clear cut code for uploading file in my page. i had written like this... on the client side. <form id="recipeform" onsubmit="return checkAll()" action="submit.php" method="post" class="niceform" enctype="multipart/form-data"> <input name="uploaded" type="file" /> And on submit.php... i am writtin...

Programming advice - Which Loops?

Theres no easy way to say this so ill just say it in the form of a story. Im looking for advice on which loops and where. Here goes: out of 200-odd fields in the database, i need to run the following against each field. extract allowed values using extract function place allowed values into an array loop the array to be inserted into ...

Are Magic Methods Best practice in PHP?

Are Magic Methods Best practice in PHP? ...

mysql condition to select empty fulltext cell?

i need write a select query to find the number of rows which have an empty fulltext field but for some reason both: select count(id) from table where field is null; and select count(id) from table where field = ""; don't seem to work! what else is there?! ...

PHP Sort Array based on values in another.....

Possible Duplicate: PHP - sort an array based on another array? Need some help regarding array sorting.... I have two arrays. The main one (where the key is the user id) : $user[31] = 'Tom' $user[43] = 'Jane' and another array with the order they should be displayed (where key is the order and value is the user id) : $or...

Strip <script> tags and everything in between with PHP?

How would I go about removing script tags, and everything inside them using PHP? ...

Multiple leaf methods problem in composite pattern

At work, we are developing an PHP application that would be later re-programmed into Java. With some basic knowledge of Java, we are trying to design everything to be easily re-written, without any headaches. Interesting problem came out when we tried to implement composite pattern with huge number of methods in leafs. What are we tryin...

Magic methods + Reflection API = can't investigate class properties. Why?

If I use magic methods. While using reflection API, I can't investigate class properties.. Why is it so? EDIT What is Reflection API? pls do not refer me php.net i didnt understood that.. guide me in your words plsss ...