php

Understanding Incrementing

For example this: var a = 123; var b = a++; now a contains 124 and b contains 123 I understand that b is taking the value of a and then a is being incremented. However, I don't understand why this is so. The principal reason for why the creators of JavaScript would want this. Is this really more useful than doing it the PHP way? What...

open source website builder web application

Hello, Is there a open source website builder application. [edit] no db entry I need to install it on my server and permit users to create pages. Not looking for cms's like drupal,wordpress, joomla etc Thanks Dave ...

Jquery Ajax Returned Array - how to handle in Javascript

Hi there, If someone could assist me please. I'm doing a jquery Ajax post, for some reason the Json object isn't working so just returning a php array instead $.post ( "classes/RegisterUser.php", $("#frmRegistration").serialize(), function(data) { alert(data); } ); The data is returned to Javascript 100% as ...

Simple Horizontal Bar Graph using php

Hi, I have seen a facebook application in which clicking on a radio button renders a graph. As you can see below: I wanted to know whether there is any similar graph library through which i can generate the same graph in php. Thanks, Pankaj ...

POST in PHP MVC Controller?

Hello All, I am learning the PHP MVC pattern for my backend implementation. Looking at this excellent example: Implementing MVC in PHP: The Controller http://onlamp.com/pub/a/php/2005/11/03/mvc%5Fcontroller.html I feel comfortable with the execution flow in a GET. But there is no mentioning of what happens in a POST. What would the t...

Login/Logout links in database driven navigation?

I have a database driven navigation mainly composed of two tables: menus and a menu_items, this works out fine for purely "static" links but now I need to have a dynamic link ( login/logout ). My menu_items table is just composed of links to pages manually added in the admin. So now I need to adjust the table and model possibly such tha...

how do I create the following .htaccess file

I have written the following code in my .htaccess file Options +FollowSymLinks RewriteEngine on RewriteRule page/(.*)/ index.php?page=$1&%{QUERY_STRING} RewriteRule page/(.*) index.php?page=$1&%{QUERY_STRING} The url "xyz.in/index.php?page=home" will look like this in the address bar of browser "xyz.in/page/home" If I want to pass a ...

file upload like yahoo mail file attachement in php ?

hello all, how to develop an application for file upload like yahoo mail file attachement in php. ...

Ways to include a scraped table into another page

Hi, I've coded a PHP script that scrapes a publicly available data table. The data changes every 5 min. My script whenever called will scrape the data using htmlsimpledom and returns me the table in HTML table format. I now want to include this result returned by the script into a wordpress page, so that every time I visit the WP page, ...

PHP to Javascript Array (Kind of)

Hi, Here in an array i have in javascript, this works great! _rowData: [ { name: "Most Recent", view: "recentView" }, { name: "Most Popular", view: "popularView" }, { name: "Staff Picks", view: "staffView" } ], How could i generate this array from a php script? I want to use AJAX to get the results returned by the php. ...

Creating image from transparent image mangles color

Hello! I'm building one kind of system, which simply creates dynamic image from other image. I use imagecreatefromstring(file_get_contents("clown_avatar.png")) to create image and output it successfully, but it messes all the colors on the transparent area. Check out the original image: Click And here is the result from php-file: Cli...

How to display non english characters in php?

Hi guys I've a basic question in php: I've 2 files: An html form with a textarea and a php file. All I want is to print the text the user types after submit is pressed. It all goes well when only english characters are typed but I get gibberish when I type arabic or chinese for instance. Is there a way to display all the characters? ...

In PHP, Is "if($value)" the reciprocal of "if(empty($value))"?

In generating a select tag for a Boolean value, I use the following code: <select name="name" id="id"> <option value="0"<?php if(empty($value)): ?> selected="selected"<?php endif; ?>>Off</option> <option value="1"<?php if($value): ?> selected="selected"<?php endif; ?>>Off</option> </select> So, the question is, will this map c...

Does PHP copy object data structures when I pass objects to functions or methods?

I know there's the option to pass a value by reference, simply by writing something like function foo(&$bar) {...} But from Objective-C I'm used to believe that objects are always passed by reference (since the variables referencing them are just pointers whose values are just a memory address). Only sctructures and primitives would ...

Confused about include_path in php.ini

I have this line in php.ini include_path = ".;C:\xampp\htdocs\zend\library;C:\xampp\php\PEAR" What exactly is the . in front of the string? And what does the line do, exactly? I know it includes the paths, but what exactly happens behind the scenes? Maybe this is a dumb question but I'm asking anyway :-) ...

Rich tree structures with PHP

I'm finding it very difficult to find anything about creating maintanable, navigatable and verbose tree structures in PHP. I wanted to open it up to the SO community and see who's done what. The way I can see creating this sort of structure is to have an object for every node, with a reference to the parent or child nodes. I've yet to p...

how to request to a remote server with cookies included (PHP/javascript)

hi I want to send a request including cookies to a HTTP website. How I can do this? I sent a request without cookies as a first-time visit and tracked the header there was a cookie inside responded header like this: Set-cookie: ERIGHTS=VQPFIWEdiYEtW4Eko2T3bikz4H2dDx2FtH-zlTTRFyzW+urkCU7bwGj2w== Set-cookie: WLSESSION=1512202892.20480....

zend framework zend_db: what does it provide to escape sql parameters

what does zend framework provides in order to escape user input into a query string ? ...

Relative path not working in cron PHP script

If a PHP script is run as a cron script, the includes often fail if relative paths are used. For example, if you have require_once('foo.php'); the file foo.php will be found when run on the command line, but not when run from a cron script. A typical workaround for this is to first chdir to the working directory, or use absolute path...

What should I do when $dbh->beginTransaction() returns FALSE, and from where can I get more information about what went wrong?

If PDO's beginTransaction() fails, it returns false. What would be the best thing to do here? Here's what I'm about to do: If it returns false, I want to log something to a file. I'm really not sure if array PDO::errorInfo ( void ) is my friend here? Would that contain more information? ...