php

Is controller-based class loading better? (CodeIgniter/KohanaPHP/etc..)

If you have worked with some of the frameworks like CodeIgniter or KohanaPHP, then you probably have seen that they are built so that the controller loads everything. Therefore, if you are in a library and wish to load additional resources you must get a copy of the controller instance and then use that to load the additional classes. $...

What is the best form for get the home directory on Windows and Linux from a PHP Script?

I need something like: get_home_user($username) ...

Create a blurb from text from a database (similar to "read more")

Hello, I am trying to cut text from a database off if <!-- break --> is found then only show what is before the break. I currently have this code //get the description before the more link $project_blurb = htmlspecialchars_decode($project_data['p_desc']); if (strstr($project_blurb, '<!-- break -->')) { $project_blurb = ex...

PHP Upload not working due to server conf

I am using this upload script here: http://www.webcheatsheet.com/php/file%5Fupload.php It is working in server 1 but not server 2 This is server 1 http://bit.ly/Cf3bm This is server 2 http://bit.ly/1LZMRY Anyone knows why? Thanks ...

Can php script continue to proccess even if user closed the browser ?

For example , there is a very simple php script which updates some tables on database, but this process takes long time (maybe 10 minutes). Therefore , i want this script to continue to this process even if user closed the browser, because sometimes users do not wait and close the browser or go to another webpage . ...

PHP how can i append data into a serialized array

if i have a serialized array...how can i append more values to it? should i unserialize it first -> add data and then serialize it again? ...

Are mysqli_multi_query php function connect 1 time to db or each query?

Hey Guys, Just wonder if the function mysqli_multi_query connect just 1 time to the database or each query? ...

How can I easily change the text on a page using zend framework and php

What I am looking for is something where I can easily change the text on a page. I want to set it to a default value and if something is present for a specific page to change it So it would say something like: I like stackoverflow But if the value of website was "reddit" it would instead say I like reddit So stackoverlflow would be ...

Is it possible to use || in PHP switch?

switch ($foo) { case 3 || 5: bar(); break; case 2: apple(); break; } In the above code, is the first switch statement valid? I want it to call the function bar() if the value of $foo is either 3 or 5 ...

iframe/include php file in flash (FLA file)

Hello. How can I load a PHP file into a flash movie ? I need an iframe in Flash or something... Can anybody post some examples ? Thank you. ...

Get self web content

Hi: I have a php that makes some maintenance operations in my web and I need that the last operation it'll do is to save into a file the content of the screen. I mean, self content. If the screen shows: "OP1 - OK ..." it has to save into a file this: "OP1 - OK ...". Saving all the results of my operations into a variable will very hard...

How do I convert PHP variables to JavaScript variables?

I am trying to insert php variables into javascript. Here is the broken code: var tokens = [<? $result = mysql_query("SELECT * FROM accounts ORDER BY id DESC") or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $user_name = $row['user']; $user_id = $row['id']; echo "['$user_name','$user_id'],"; } ?>] ...

PHP and Twitter | Create Index Engine

Here is what I have in mind: 1) Create a service that will run every hour or so and search for twits using a specific criteria 2) I also need to filter out garbage (index engine needs to be smart enough, kind of like anti-spam service) What are the best strategies/ideas to accomplish this? PS Any ideas if there is anti-spam engine a...

PHP quiz send data to next page

ok, i'm trying to do a quiz...all good by now. but when i'm trying to send the collected data(radio buttons values) through pages i can't get the logic flow. I have the main idea but i can;t put it into practice. i want to collect all radio values create an array containing this values serialize the array put the serialized array into ...

Save DIV content as image

hi i have a div that shows some content (several images, text, floating elements, etc) and i would like to add the posibility to user do something like "Save this content as image" how can i do that? i read all the php doc but there's nothing good to do this, even imagegrabwindow sucks because of its high load, browser limitations and ...

Cant get the zend loader to load classes only under wamp

I'm trying out the zend framework classes for the first time. I am interested in using some of the individual classes for now. Reading the documentation and some other q's here and in blogs I've tried three ways to load the classes //attempt 1 - using zend loader require_once('library\Zend\Loader.php'); Zend_Loader::loadClass('Zend_...

PHP + LibPuzzle on Windows?

Hey all, I've been messing around with this awesome library on my *nix box, but would like to use this on my Windows test machine. Does anyone have any experience in getting this to work on a WAMP stack? Can't seem to find any obvious answers on the source site: http://libpuzzle.pureftpd.org/project/libpuzzle I'm playing around with t...

php: simulate mysql result set

I'd like to pull values from textfiles in a directory and put these lists of values into arrays. I am not sure however how to arrange these arrays into a mysql result set "like" object. Here is what I have so far: // Retrieve all files names, create an array $dir = './textfiles/'; $files1 = glob($dir . '*' . '.txt'); foreach ($fil...

PHP: Create array of arrays, ignoring empty arrays

I need to create an array of arrays. I have been using array_map(null,$a,$b,$c) to do this and it works fine, however, it doesn't work if one of the mapped arrays doesn't exist. To get around this problem I have used: $myArray= array(); if (isset($a)) { array_push($myArray,$a); } if (isset($b)) { array_push($myArray,$b); } if (isset(...

Handling Enumerated Type Parameters in WCF service for a PHP client

If I have the following WSDL method − − and "EnumeratedIdentifier" is a C# enumerated type, how can I make a service call to this method in a PHP client, since PHP is loosely typed? Thanks in advance. ...