php

Any detached/independent Session Library in PHP using Flat File or MySQL?

Any detached/independent Session Library in PHP using Flat File or MySQL? ...

MySQL functions don't load when using custom PHP.ini on windows server

php.ini on the server loads mysql functions, but as i have to use a custom php.ini on the site root, after adding the file the server is not loading mysql function. without the custom php5.ini file mysql functions and their values appear in the phpinfo() but when i create the custom php5.ini on the site root and run the phpinfo() mysq...

Why Does this Loop Return 1 when using && instead of 'and' ???

Riddle me this... in the while($row = mysql_fetch_assoc($result) and $runningOK) loop, if the PHP && operator is used in place of the and the mysql_fetch_assoc fails terrible and returns just the number 1 when running. I've tried mysql_fetch_array() and in place and I still have the 1 problem. It is when, and only when, I replace the && ...

Grouped/Stratified Reports using PHP and MySQL

I am trying to generate a grouped/stratified report using PHP and MySQL. tbl_items has the following fields: (1) UserName and (2) ItemName A single user can have multiple items listed. I want to generate an output where the data is stratified by each user. For example: *UserName #1 -ItemName 1 -ItemName 2 *UserName #2 -ItemNa...

mkdir not working in PHP

Have been pulling out my hair for the past 2 hours on this and am sure I am doing something really stupid. <?php mkdir("blah", 0777); ?> This works through the command line and the folder gets created. But the same thing doesn't work when I try to run it through the browser. Any file permission issues? ...

boolean in if statement

if i want to execute a code only if a variable is true should type: if($option) { code } or if($option == TRUE) { code } doesnt the first one imply that also values like 1, 2, 3 etc will execute the code. so the second one is the best? ...

Www-data User to Access files/folder outside of /var/www/

Ok, is there a way for the PHP user (www-data) to gain access to other parts of the server, for example, /home/username/another_folder/ ?? Thanks in Advance. Will EDIT: Do I just add www-data to another group?? Or something like that, or is there another way? ...

How to sort a linked list in PHP?

$arr[] = array(...,'id'=1,'prev'=>2,'next'=>null); $arr[] = array(...,'id'=2,'prev'=>3..,'next'=>1); $arr[] = array(...,'id'=3,'prev'=>4,'next'=>2); .. The order of each record can be arbitary. How to sort this kind of array so that record with prev's value null is first,and the one with null next is last? ...

using require inside a class

i want to make a "loader class" that will require selected files. so i just can call eg. loader::load('systemLibraries, 'applicationLibraries'). so inside this load() method i will use require. but i have tried this and it seems that the files required can't be used outside the class. how can i make it globally accessed? ...

how to tell if a php array is empty

players will either be empty or a comma seperated list (or a single value). What is the easiest way to check if it's empty? I'm assuming I can do so as soon as I fetch the $gameresult array into $gamerow? In this case it would probably be more efficient to skip exploding the $playerlist if it's empty, but for the sake of argument, how wo...

How to write a php client script to fetch data from the wsdl below

http://zhx.17u.cn:9080/TBEWS/services/AirAvail/wsdl/AirAvail.wsdl I have written one, but it doesn't seem to work: $soap = new SoapClient('http://zhx.17u.cn:9080/TBEWS/services/AirAvail/wsdl/AirAvail.wsdl'); $parameters = array( 'req' => array( 'originDestinationInformation' => array( 'departureDateTime' => ti...

using objects in ajaxcalls php files

i have instantiated a class in my index.php file. but then i use jquery ajax to call some php files but they can't use my object that i created in the index.php file. how can i make it work? cause i don´t want to create new objects, cause the one i created holds all property values i want to use. ...

Checking for empty arrays: count vs empty

This question on 'How to tell if a PHP array is empty' had me thinking of this question Is there a reason that count should be used instead of empty when determining if an array is empty or not? My personal thought would be if the 2 are equivalent for the case of empty arrays you should use empty because it gives a boolean answer to a ...

In loops, does this matter?

A while( x < 100 ) { if( x == 1 ) { echo "Hello World!" } else { echo "Bottles" } x++; } B while( x < 100 ) { if( x != 1 ) { echo "Bottles" } else { echo "Hello World!"} x++; } Would it really make a difference when having such a big loop? ...

Zend Debugger Terminates After Index Page

I have a website running using Zend Framework and am trying to setup Zend Debugger. Zend Debugger is installed and it works correctly with the tutorial PHP pages however when I try debugging with my app, it will work for the index page but then the debugger will terminate. I am running Apache2.2 with PHP 5.3. I have a virtual host set...

The advantage / disadvantage between global variables and function parameters in PHP?

sorry i'm a beginner and i can't determine how good a question this is, maybe it sounds utterly obvious to some of you. if our use of these two below is the same which is better? function doSomething ($var1,$var2,..){ ... } OR function doSomething (){ global $var1,$var2,..; ... } by our use I mean that I know that in t...

Autocomplete in .php framework doesn't seem to work any longer

I have a basic Autocomplete and Add to the database function and , for some reason, it has stopped working completely and I don't get any useful information from Firebug or otherwise what could be the problem. I am guessing it is something simple, but don't know where to look. This is the library where I am making the call: http://git...

Showing php page as an image

Hi, is that possible to show whole php page as an image file like png or jpg ? for example, <img src="details.php?id=44"> just like a screenshot of the page. Thx ...

What am I doing wrong with preg_match_all?

The object is to find sets such as <!-- content:start -->some content here<!-- content:stop --> and process each one to put it into an array, but every time it find no matches and echos my die statement without printing any matches out. This is the current function that is being executed. function boom($data) { $number = preg_match_...

retrieve mysql data

I have this code for listing mysql records and putting it into a table according to the address inputted. My problem is, how to do just the same but this time, making use of textboxes to project the contents of the record corresponding to the same data inputted. I'm just a beginner with no talent. Maybe you could give me some idea on ho...