php

Help troubleshooting PDO prepared statement

I've just started learning aboud PDO and prepared statements (which sure seem to beat remembering to use mysql_real_escape_string() every time) but I'm having trouble getting the script to execute properly: <?php error_reporting(E_ALL); echo "start"; try{ $dbh=new PDO('mysql:host=localhost;dbname=DBNAME','USER','PWD'); } catch(PDO...

Code block execution order in PHP

I remember there was shortcut key (probably F8) in Turbo C that showed which codeblock C would execute next. I wonder if something similar is availabe for PHP? I'm an absoulte beginner and sometime I just don't get how things are executed in PHP. Thanks. ...

Iframe Url after initial page is navigated from

Hey i am wondering if their is a way to get the URL of the page showen in a iframe with php or javascript. i want it so that when i user clicks a link in the iframe so it isnt the initial iframed page then clicks another button that button it will get the new URL of page that is currently in the iframe. thanks ...

apache/nusoap returns BAD REQUEST 400 when .htaccess applied

I have a nuoap 0.7.3 webservice installed on APACHE 2 with PHP5. The web service is being consumed from a .net client and all works as long as the folder contents aren't secured with a .htaccess file. Accessing via IE or Firefox causes prompt and all works as expected. Have performed WebRequest with credentials applied and they are acc...

Post form while retaining get variables

This seems so simple but I can't remember how I've done it before. Using PHP I'm posting a form from mysite.com/?x=y and want the resulting page to be mysite.com/?x=y&formx=formy... Options I've tried don't quite give the desired result: action - setting action="?x=y" clears the get variables if method="get" in place of those in the f...

Possible to add background color to transparent image using GD and PHP

Hi, I have the thumbnail creation class written with php language using GD. I want to know is when i upload the transparent image which is png or gif, can i be able to put background in that thumbnail image ? If that's possible, please kindly guide me how. Thanks. ...

php $GLOBALS variables

I'm writing a bit of the code and I have parent php script that does include() and includes second script, here is snippet from my second code: echo ($GLOBALS['key($_REQUEST)']); I'm trying to grab a key($_REQUEST) from the parent and use it in child, but that doesn't work.. this is when I run script using command line: mbp:digawe...

Php - Looping For Different CSS

MySQL $selectSize = "SELECT * FROM products"; $querySize = $db->select($selectSize); while ($product = $db->fetcharray($querySize)) { HTML <ul> <li>Product A</li> <li>Product B</li> <li class='right'>Product C</li> <li>Product D</li> <li>Product E</li> <li class='right'>Product F</li> </ul> Question While getting the prod...

PHP get date as Unix Epoch time

I just got some tweets using their XML feed, and have gotten the date/times like so Tue Sep 29 22:30:51 +0000 2009 I tried using strtotime() on this, but it wasn't producing the correct results. I later on use echo date($dateTimeFormat, $twitterUnixTime); I know I could use a regex, but from the looks of it it will be complica...

Loading a file with cURL

Please bear with me, I'm trying to learn php and all about how deal with files & setup on the server side. All was fine until I recently had to switch my hosting site. This new hosting site has their url_fopen turned off. My previous script was using: file_get_contents ("that.htm"); but now I need to use cURL. I've figured out how to...

Is there anyway to expand image on hover like bing image search???

I have a search result which includes images. When the user hover over the image, the image should expand like we see in bing http://www.bing.com/images/search?q=world&amp;go=&amp;form=QBIR&amp;qs=n . Please help. ...

urlencode() error when using Zend_Controller_Router_Route and URL view helper

I am using the standard router in Zend Framework to route most URLs in the system. For one particular URL, I want to access it via a controller alias (in addition to the real controller) For example. Actual URL: /mymodule/mycontroller/myaction/* Alias URL: /mymodule/mycontrolleralias/myaction/* mycontrolleralias is not a real co...

What is the second parameter doing in model("pagemodel", 'pages')

I have following model and controller. And database table pages has id, title, content and slug. Q1. Why does the line in controller, $this->load->model("pagemodel", 'pages'); // Load the page model, have 'pages'? Is it naming "pagemodel" as pages? And I see a line, $page_data = $this->pages->fetch($page_slug); // Pull the page...

Virtual Dedicated Server Question

Hi I have a Virtual Dedicated Server, how can I run an application periodically (ie: every Monday - 19:00). I mean, the application starts automatically at a given time. Is there any way to do it with Java, Ajax, PHP? (sorry, I'm noob) ...

how to compare the two date

hi , I have a mysql database with a php front end. In my records I have an posted date and an expire date directle access from database. What I need to do is check and see if any records expire date matches posted date, Something like: <?php $posted_date= $row_Recordset1['date_posted']; ?> <?php $exp_date= $row_Recordset1['expire_dat...

oAuth in PHP to make 2 legged request

I am currently stuck trying to make requests to a service's api using a 2 legged oAuth request using PHP. I am using the PHP library found here: http://code.google.com/p/oauth-php/ and there seems to be absolutely no documentation anywhere online for using this library for a 2 legged request. So currently from the service I have the fo...

how to use not equal operator in Cakephp

Hi, i am having a action in the cakephp controller as which takes the report_id as an argument and the Selected Fields as an array . i am trying to compare the array that contains the already existing attribute ids with the array what i have received from the action post .. if that particular attribute id if not present in the r...

Run a script based on timestamp entered in MySQL database

Hi I have a requirement to run a server script on scheduled times entered by the user. This is for a program for scheduling emails. A user can enter the specific times when they want to send the mail. I have a table which stores the userid, the email text and the time at which the mail is to be sent. This time is defined in minutes. I d...

Store '\abc\def\fg.jpg' Problem in MySQL

I need to store relative path of a document into a MySQL table. The problem is that when I insert a string of this form: $urlPath ='\abc\def\fg.jpg' into the relevant column, what I get is, I have all the slash '\' strip off, with an unknown symbol in front of all the text. So the result in the MySQL table is something like this: '(w...

PHP: How to sum values of the array of the same key

Hello, How can I add all the values of the key gozhi? Note that 'gozhi' key is dynamic. <?php Array ( [0] => Array ( [gozhi] => 2 [uzorong] => 1 [ngangla] => 4 [langthel] => 5 ) [1] => Array ( [gozhi] => 5 [uzorong] => 0 ...