php

PHP Pass by reference

I am calling this function which is modifying an array by reference: function addWord(&$words, $wordIndex, $word) { $words[$wordIndex] = $word; } At the function call, addWord(&$words, $wordsIndex, $word); ($words is used only during the function call) doesn't work. How do I make this or a similar functionality work? I want the a...

Facebook Connect PHP SDK Curl Peer SSL Verification Error

I'm integrating Facebook Connect into our application. I thought using Facebook Official SDK at http://github.com/facebook/php-sdk is the best way, as it is advertised on FB Developers wiki. But I couldn't manage to make it work. When investigating the API code, I remembered my previous experiences about CURLOPT_SSL_VERIFYPEER parameter...

PHP 5.3 now allows redirects after writing content?

I recently made the jump from php 5.2 to 5.3, and I've noticed that it will now allow redirects (ie. headers) after writing content, presumably through some sort of automatic output buffering. I used to think it was annoying the other way... but this makes it much harder to track down errors during development. Is there a way to turn t...

nxhtml and geben: debug mode stops responding to keystrokes upon step into html/php mixed line

I'm using the php debugger geben and nxhtml-mode. While debugging, as soon as I step into a mixed line such as <foo><?php bar(); ?></foo> the debugger is no longer accepting any key-strokes. However, the mode line still indicates the debugger's presence (*debugging*'-entry). I guess this due to nxhtml's mode changes, because it's ...

php troubles with coding variables

I am trying to echo certain values if the variable $cardtype == $paymentmethod = if( $cardtype == 'visa' ) echo 'VSA'; elseif ( $cardtype == 'mastercard' ) echo 'MSC'; elseif ( $cardtype == 'mastercard' ) echo 'MSC'; elseif ( $cardtype == 'maestro' ) echo 'MAE'; elseif ( $cardtype== 'amex' ) echo 'AMX'; How would I do this???...

Integrating Dokuwiki in a Drupal site

Hi, Does anyone have experience or suggestions on how to integrate Dokuwiki with a Drupal site? What I want to achieve is for a user to only have to log in only once with Drupal and be able to access the wiki when they navigate to it. ...

Unable to pass variable data

I am trying to use the following code to pass information to another site but it keeps giving me an error: Invalid Code: $a = $b->doIt("James",$_SESSION['JNum'],"Frank"); Valid Sample Code: $a = $b->doIt("James","123456","Frank"); In the first example, the page returns "number field is required". The second piece of sample code r...

php call standard function by string

I need to call a PHP standard function from a string Example: $param = "parameter"; $functionname = "createimagefromjpg"; //call the function (with a parameter) Anyone has an idea how I can do this? It can't be done with call_user_func() because it is a standard function. ...

second sorting with php usort

So Ive got a pretty big array of data and need to sort them by two criteria. There is variable $data['important'] and $data['basic']. They are simple numbers and I am using uasort to sort $data firstly by important and then by basic. So Important | Basic 10 | 8 9 | 9 9 | 7 7 | 9 The usort function i...

PHP SQL: Matching corresponding Data between 2 tables, without Filtering out Data in 1st Table

I have 2 tables. For simplicities sake 'u' has the following columns userid divisionid 'd' has the following: divisionid name I did not create this table, otherwise I would not have this problem. u.DIVISION can be NULL. d.DIVISION cannot. Running the following creates the appropriate data, but it also filters out every single userid t...

Code Igniter Update Engine

Hey, I am planning to develop a pretty awesome new web app that has a one time fee including free updates of 1.X updates (X being the update). I don't want to get people to download a new version and install it manually as it can be a real pain for some people, also it's bad if there is an important bug that needs fixing and people don...

Setting the inner html text of a < span > element using Zend_Form_Decorators

I'm trying to set the inner html of the < span > tag here , so it looks like: Group this is what i have so far: $form->addDisplayGroup( array( ................ ), 'maingroup1', array( 'legend'=>'', 'disa...

php - feof error

The file that I'm trying to read is a pgp-encrypted file. This is part of the process to decrypt it and I'm actually attempting to read the contents into a string so that I can then decrypt it. I'm not sure if that's the core problem here or not, but I'm getting an error: Warning: feof(): supplied argument is not a valid stream resou...

Asp.net renders string with wrong encoding, but PHP doesn't (MySQL)

I took over some old php application with MySQL as database. Inside the database, there are tables including content with localized strings (therefore containing special chars) Currently there is a PHP application accessing that database. My job is to create an ASP.net (C# codebehind) application that accesses that strings as well. That...

PHP SQL, SELECT corresponding data from 3 tables at once?

I have 3 tables, 'u' 'd' 's' 'u' has userid divid 'd' has divid divname 's' has sname primaryuserid secondaryuserid Now what I'd like to do is display a table with rows of the following format userid, divname, sname Plus figure out a way to decipher whether userid is a primary or secondary for this sname table. I'm abl...

How to detect page redirect with PHP?

I'm trying to detect whether an image exists on a remote server. However, I've tried several methods and can't get any of them to work. Right now I'm trying to use this: if (!CheckImageExists("http://img2.netcarshow.com/ABT-Audi_R8_2008_1024x768_wallpaper_01.jpg")) { print_r("DOES NOT EXIST"); } else { print_r("DOES EXIST"); }...

PHP, MySQL prepared statements - can you use results of execute more than once by calling data_seek(0)?

Hello, I have a case where I want to use the results of a prepared statement more than once in a nested loop. The outer loop processes the results of another query, and the inner loop is the results of the prepared statement query. So the code would be something like this (just "pseudoish" to demonstrate the concept): // not showing th...

Complicated football league Dynamic Ordering in MySQL?

I have a table 'games' for a football league as follows: date home_team_id away_team_id home_score away_score - 1 2 6 21 - 3 1 7 19 I can't figure out how to dynamically generate a list of team ID's ordered by Wins (then...

optimistic and pessimistic locks

Working on my first php/Codeigniter project and I’ve scoured the ‘net for information on locking access to editing data and haven’t found very much information. I expect it to be a fairly regular occurrence for 2 users to attempt to edit the same form simultaneously. My experience (in the stateful world of BBx, filePro, and other RAD...

What is the proper syntax for describing a <SELECT> form element to Zend_Form using XML as the config?

I am using an XML config file to tell Zend_Form what elements I want. I would like to have a <select> element, but I am unsure as to how to add <option> tags using the XML syntax. Sure I am missing something pretty basic. Ben ...