I am writing a sql query creator using some parameters. While doing that ,I came across this problem. In java , Its very easy to detect the last element of an array from inside the for loop by just checking the current array position with the array length.
for(int i=0; i< arr.length;i++){
boolean isLastElem = i== (arr.length -1) ?...
I am trying to upload file using zend frame work but have not been successful. I have read Akras tutorial, which was helpful but when i used those techniques in my project I was not able to get it to work.
...
I am doing a tutorial and getting this error: Fatal error: Class 'MySQLi' not found (LONG URL) on line 8
the code on line 8 is:
$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
I saw online someone said to to see if it was turned on in my Phpinfo() but there wasn't anything listed in there under f...
I am using windows live contacts api to create find a friend functionality in a PHP 5 application. I am able to get the results fine but it's encoded "deflate". I have tried using gzuncompress to decompress but it returns false. If any one has experience using this api with php 5 and can help that would be great.
...
I am trying to access a static variable within a class by using a variable class name. I'm aware that in order to access a function within the class, you use call_user_func():
class foo {
function bar() { echo 'hi'; }
}
$class = "foo";
all_user_func(array($class, 'bar')); // prints hi
However, this does not work when trying to ...
Using PHP 5.2.0-8+etch13 on a LeaseWeb server, I have code that process a file emailed to a certain address by picking up the email via imap. I call imap_open (checking for errors and not finding any), get the number of messages via imap_num_msg, and look over then calling imap_header on each. All runs without errors.
I then check if ('...
I have a very specific problem here. I have a multi-dimensional array that I want to sort first by half-hour time intervals, second by dates. The function array_multisort will not meet my requirements.
Example: I want:
array(array("time"=>"12:15",
"date"=>"2009-03-24"),
array("time"=>"12:10",
"date"=>"20...
I have a group of text based rules that are structured like this:
Rule 1: Do [XXX] when [PN] greater than [N]
Rule 2: Get [PRD ..] and add [X.XX]
To go with this is an array of data that translates each grouped code into a CSS class ID (for jQuery).
I also have an array of translations from [code] to ID stored in a simple structured...
I have an RTF file that I need to display to a user. I know that I need to convert it if I want to display it in the browser. I would like to be able to convert it to JPG so that I can take advantage of other code that I am using that uses ImageMagick to convert JPG to PDF. ImageMagick will convert a PDF to a JPG, but not an RTF :( I...
By default, RHEL5.x64 comes with 5.1.6 - pretty old. I'm looking for a more up to date version, 5.2.8, or even the latest 5.2.9 (as of March 2009). Ideally, a Yum/RPM-based solution, for transparent upgrades (when I plan).
How do you upgrade the default for an up-to-date version?
...
When im trying to connect to an Exchange 2007 server over IMAP in PHP5 I get the following error message.
Kerberos error: No credentials cache found (try running kinit) for smtp.domain01.net
I was wondering if somebody found a way around this issue?
Related info:
http://bugs.php.net/bug.php?id=33500
...
I have this simple code in php:
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=kid_tag.doc");
echo '<table cellspacing="0" cellpadding="0" border="0" width="8.4cm">
<tr>
<td colspan="3" style="text-align: right; height: 0.6cm">Nursery</td>
</tr>
<tr>
<td ...
On my XAMPP/Win XP build, PHP5.2.3 fails to catch any exceptions. None of the examples work, and this:
try {
throw new Exception('Fail');
} catch (Exception $e) {
echo 'Succeed';
}
...results in:
Fatal error: Uncaught exception
'Exception' with message 'Fail' in
M:\path\to\test.php:4 Stack trace: #0
{main} thrown in ...
How can I use download.php?get=file.exe with without the get variable, like download.php?=file.exe, using the $_GET in PHP?
...
I have a site that is written completely in PHP4 - the supported version on my hosting at the time. After tons of time on this language, I've come to see that PHP5 has a lot of stuff that I think would be useful to me.
Two questions:
Would switching my hosting to PHP5 cause any serious damage to existing PHP4 scripting?
Is PHP5 consi...
There are some posts about this matter, but I didn't clearly get when to use Object Oriented coding and when to use programmatic functions in an include. Somebody also mentioned to me that OOP is very heavy to run, and makes more workload. Is this right?
Lets say I have a big file with 50 functions, why will I want to call these in a cl...
$split_point = ' - ';
$string = 'this is my - string - and more';
How can i make a split using the second instance of $split_point and not the first one. Can I specify somehow a right to left search? Best simple approach?
Basically how do I explode from Right to Left. I want to pick up the last instance of " - ".
Result I need:
$ite...
Need a tutorial or some instruction on how to use the XML-RPC library built in to PHP (version PHP Version 5.2.6) for a XML-RPC client. The server is in Python and works.
Google and php.net are failing me.
Update:
Per phpinfo I have xmlrpc-epi v. 0.51 installed. I visited http://xmlrpc-epi.sourceforge.net/ but the xmlrpc-epi-php exam...
What's the difference between
$PDOStatement->fetchColumn();
and
$PDOStatement->fetch(PDO::FETCH_COLUMN);
(if one exists)? Or are they functionally similar but only aesthetically different?
...
I'm doing a print_r on a array stored on a session variable and for some unknown reason it's adding a number after the array prints.
Example:
Array
(
[0] => 868
[userid] => 868
)
1
If I do a print_r directly in the function itself and before the variable gets stored on session variable, it doesn't add that number 1.
Solution...