php

declarations error in include and require functions

I write this code include('database.php'); function get_something() { database instructions } function get_another(){ database instructions } and I try to fix by this function get_something() { include('database.php'); database instructions } function get_another(){ include('database.php'); database instructions } ...

How to generate simple pop up using Jquery

I am designing a web page. In that when we click the content of div named mail, a popup window should be shown containing a label email and text box. I searched in google as simple popup in Jquery but the code is weird. Please help me by providing very simple jquery pop up. ...

double $ statement in php

What does the double $ statement stands for in PHP? ...

PHP 5 SOAP client returns NULL when WSDL-provided function is called

Hi all, I am trying to use a webservice to look for specific users from my PHP application. I have used that exact same webservice in ASP.NET with success. Basically, I do everything like the PHP doc tells me to, and I use the same methods/variables I used in ASP.NET (for the webservice itself), but I can't seem to get a result. The f...

Echo row 30 with php from sql result?

I want to get a result from sql with unlimited rows, I don't want to use limit in my sql statement because I need to know the total number of rows. But I just want to echo, for example row 30-60. I use php. ...

Weird PHP behavior: won't assign the integer 8 to a variable

I think I just encountered the strangest 'bug' I've ever encountered in my short developer life. It seems like I just can't assign the value eight to any variable. For exemple: <?php $seven = 07; $eight = 08; //what's wrong here? $sevenB = 7; $eightB = 8; echo $seven; echo $eight; echo $sevenB; echo $eightB; ?> The output is: 7078 ...

WordPress Subscribe2 plugin escapes characters in blog name when sending email

Hello, I'm using Subscribe2 plugin in my new upcoming WordPress blog (http://www.adlerr.com). My blog's title is "Roee Adler's Blog". When sending an email, Subscribe2 escapes the apostrophe in my blog's title, and the e-mail subject is received as follows: [Roee Adler&#039;s Blog] Please confirm your request The e-mail body is: Roe...

PHP and MySQL search across lots of columns

I need a way to search through 50+ columns, both varchar and int, in a specific table. I've seen people recommend Lucene and Sphinx, but I have no clue how to go about using those and MySQL's Full-Text won't allow me to combine more than 16 columns or both varchar and int columns. ...

Zend Framework PDF problems

It's me again guys, I have a small problem: // Create new PDF $pdf = new Zend_Pdf(); // Add new page to the document $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); $pdf->pages[] = $page; // Set font $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 20); // Draw text $page->drawText('Hello...

Documentation structure for web application

Hey all, Does anyone know of a decent standard way to structure documentation for a web application using php doc? I can't really find any examples. Thanks. ...

What's wrong with this code? Trying to output a number pattern...

There is a pattern that goes like this: 1 11 21 1211 111221 ... I'm trying to write PHP code to output this, but my output is: 1 11 21 12 11 21 12 ... Here's the code: <? $sequence = "1"; for ($i = 0; $i < 99; $i++) { echo "{$sequence}<br />"; $n = 0; $x = 0; $z = 1; $newsequence = ""; for ($y = count(...

To inform users of denied access, is it better to redirect to a different page/document using HTTP headers or is it best to incorporate a message in the dynamic page?

I would like to know what is the best practice for informing a user that their access attempt was denied. I realize there are probably more options, but these are the methods I'm considering: Inform a user on a dedicated "Access Denied" page reached when my script redirects them via header("Location:") Inform a user in message in the r...

Retrieve first key in multi-dimensional array using PHP

I would like to retrieve the first key from this multi-dimensional array. Array ( [User] => Array ( [id] => 2 [firstname] => first [lastname] => last [phone] => 123-1456 [email] => [website] => [group_id] => 1 [company_id] => 1 ...

PHP: Download file from different web server using basic authentication?

I have been using PHP for a while but I am not too too advanced. I do not have much experience with server-to-server stuff. I need to research setting up a data-feed with a vendor. The contact person that I talked to said I would be downloading a file from their server using a username and password via basic authentication. Can someone p...

PHP Regex Help for hashtags

Hello Peeps, I have the following string: $str = '#hello how are #you and #you and #you'; I would like to wrap some html around those which have the hash tag in front of them, for exampe: echo preg_replace("/#([A-Za-z0-9_]+)(?= )/", "<a href='http://url.com/$1'&gt;$0&lt;/a&gt;", $str); Which will output: #hello how are #you and #...

What's the correct way to reuse connections in case of PHP and MySQL?

I've tried restoring connections in $_SESSION, but can only reuse for one user. Any better solutions? ...

What are the Practical Differences Between "associate" and "indexed" Arrays in PHP?

The PHP array type is actually more akin to an an ordered map than a traditional C array. It's PHP's original general use data structure. The manual goes as far to say The indexed and associative array types are the same type in PHP, which can both contain integer and string indices. However, there's a lot of cases where built-in lang...

PHP 5: how to write utf-8 binary data - image - to output?

Hi, I have a Ubuntu server and PHP5, and the PHP script files, and all output are in UTF-8. I'm trying to send an image to the output stream, but just garbled chinese characters shows up in the output: $im = imagecreatetruecolor(120, 20); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, 'A Simple Text Stri...

eAccelerator vs APC

I know this topic has been beat to death but a lot of the things I read are from 2006 and a few years old. Surely each must have some improvements since? Anyways, which is faster and where can I find up-to-date benchmarks of both? I know APC will be included in PHP 6 but isn't that because it's written by PHP? eAccelerator from what ...

How to copy an object by value / clone an object in PHP 5

I have this code: foreach ($this->configObjects as $k=>$object) { $configObject=$object; //Here I will make a lot of changes to $configObject, however // I want all those changes to be kept only to the local copy of $configObject, // So the next time this foreach loop is run $this->configObjects array will contain // a c...