php

PHP list of specific files in a directory

The following code will list all the file in a directy <?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thelist .= '<LI><a href="'.$file.'">'.$file.'</a>'; } } closedir($handle); } ?> <P>List of files:</p>...

Order displayed results by id in php

Hi there! A webpage displays results from a table in a MySQL database and then order's them using; $quey1="select * FROM tbname ORDER BY id DESC"; "id" uses auto_increment. I have deleted some of the id's. <- Is this why the ordering isn't working? How can I fix this? Thanks in advance! ...

Can you only return a string using jQuery Ajax?

I have been thinking about this. I am aware you can use json_encode(); to send an encoded array or multi-dimensional array via the jquery ajax call which will interpret the json array for you. However I am not aware of any other techniques to send more than just a string using echo, print or return from PHP to the jQuery script? Can so...

Suggest product catalog script/framework in PHP which doesn't displays product price

Hey all, I am new to web development and have this project in hand where in I have to build a product catalogue. I don't want any cart functionality or other such features, I just want to display the products,their specifications and images etc. on the website and give my client an admin panel to manage products. Now I looked into variou...

Permission denied after image upload

I've got a image upload script that works on my Apache on IIS development server, but on the Apache Lunix live server, although the images are uploaded correctly and the MySQL database is updated correctly, I can't view the images. Viewing the HTML source, checking both the FTP files and the database values, all look OK. But the image ...

Joomla and PHPBB3 integration

Hey folks, I'm on a current web project, on which there's a working PHPBB3 installation in (root)/phpbb3 All other files of the page are directly on (root)/ and are manually programmed. now I have to refactor the whole page with Joomla and want to integrate the PHPBB3 directly into the main page, so that header, menu and footer of t...

XDebug not working with xampp

I'm using (or trying to anyway) use the bundled XDebug with XAMPP 1.7.2. It comes bundled with Apache 2.2.12, PHP 5.3.0, XDebug 2.0.5 and Zend (not sure on version) This is a totally fresh install of XAMPP, the only thing I've added to php.ini (at xampp/php/php.ini) is: zend_extension_ts = "C:\xampp\php\extensions\php_xdebug.dll" [xdeb...

Zend_Pdf how to set 595x842 image as a background of A4 pdf

I have an image with 595x842px dimensions, I would like to use the image as a background for a page in pdf. I want it to fill the whole background. How can I do that? I have this now: <?php error_reporting(E_ALL); set_include_path(get_include_path() . PATH_SEPARATOR . 'd:/data/o'); // Load Zend_Pdf class include 'Zend/Pdf.php'; // ...

php header location attribute not working

I have a header location problem despite following all the advice I can find online. The mailer script sends the email(s) but I get a 'headers already sent' error relating to Line 29 which is {header("Location: $thanksURL");} and no redirect to the confirmation page. If I replace the header location code with an instruction to print a co...

Magento products by categories

I try to get productsCollection by this code: $collection = Mage::getModel('catalog/category')->getCollection(); /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */ $collection->addAttributeToSelect('url_key') ->addAttributeToSelect('name') ->addAttributeToSelect('is_anchor') ->addAttributeT...

Retrieve XML from a third party page in PHP

I need read in and parse data from a third party website which sends XML data. All of this needs to be done server side. What is the best way to do this using PHP? ...

Classes within classes in PHP

Can you do this in PHP? I've heard conflicting opinions: Something like: Class bar { function a_function () { echo "hi!"; } } Class foo { public $bar; function __construct() { $this->bar = new bar(); } } $x = new foo(); $x->bar->a_function(); Will this echo "hi!" or not? ...

osCommerce custom PHP page

Hello! One of my client has an old osCommerce website and while working on it I have to implement what I would call "custom php page", i.e. a page which query a MySQL table, not related to osCommerce, and list the result. I'm not sure of the version, this trick I have seen a lot didn't gave me any result : http://www.clubosc.com/how-to-...

php: ip2long returning negative val

hi, function ip_address_to_number($IPaddress) { if(!$IPaddress) { return false; } else { $ips = split('\.',$IPaddress); return($ips[3] + $ips[2]*256 + $ips[1]*65536 + $ips[0]*16777216); } } that function executes the same code as the php bundled function ip2long. however, when i print these 2 values, i get 2 different return...

"No such file or directory" SQLSTATE error using PHPUnit with XAMPP & Zend Framework

The error I'm getting is below. Zend_Db_Adapter_Exception: SQLSTATE[HY000] [2002] No such file or directory I've tried setting the xampp php to be the php in my PATH, hoping that it's a configuration file, but I had no luck with that. I'm not really sure why else it would say no such file or directory. Does anyone have any ideas? Up...

How to allow to users to access control their different profile elements?

Hi, Table users User_id, username, display_name, date_of_birth, email, telephone, website On some social networking sites, I can control who can view my email, date_of_birth or display_name, for example, friends can view my email but not guests etc. If I have to offer something similar on my website where users can contol email, tele...

How to get color map of an image in PHP?

imagecolorat can only return the color index for a single point, is there a function to get all colors in an image? ...

How to show only few lines from a body text

Hi, I have a mySql database i want to display only 10 words from its body field which contain html codes, How i can do that, is there any php function to do that. ...

session variables become unset when reloading page

hello, my basic issue: i allow a user login using a form, passed to a verification page, which then registers variables and lastly allows the user (me) to visit the posting page. now, on this posting page i allow a content management system (edit and delete old posts). i do so by displaying results in a div that is formatted with sc...

Magentoo add slashes to file_name

I try extend an core class. But catch error: Warning: include( \\\\\\\\\\\\MyModule\Ajaxsearch\Model\Resource\Eav\Mysql4\Product\Collection \\\\\\\\\\.php) [function.include]: failed to open stream:... Why magento add slashes to addres? May be config error? ...