php

send link on json data using ajax jquery

i m using auto suggest using Ajax Json . now when a user select a user name , i want to send user on the link of that user name my json data is coming in this way { query:'hel', suggestions:["hello world","hell boy ","bac to hell"], data:["2","26","34"] } now what i want that user goes to http://userProfile...

How should I display errors when a dynamic XML document is requested?

I'm currently writing a PHP script that 3rd party clients will be able to access using GET. It will take a few GET parameters and return an XML document with results. My question is, if required GET parameters are left out or contain invalid data how should display errors back to the end user? Should I return a completely different XML...

What's the difference between those PHP if expressions!?

Hello, What's the difference between those PHP if expressions!? if ($var !== false) { // Do something! } if (false !== $var) { // Do something! } Some frameworks like Zend Framework uses the latest form while the traditional is the first. Thanks in advance ...

OpenCart vs. PrestaShop vs. OXID eShop

Hi all, I'm currently looking for a new e-commerce solution for a small to medium-sized webshops. By now I've narrowed it down to 3 competitors: OpenCart (http://www.opencart.com/), PrestaShop (http://www.prestashop.com/) and OXID eShop Community edition (http://www.oxid-esales.com/). I'm interested in pros and cons of the different sol...

PDO:sqlite doesnt INSERT data, yet no error

. try { $res = $db->exec($sql); if ($res === FALSE) { print_r($db->errorInfo()); die(); } } catch(PDOException $e) { die($e->getCode().':'.$e->getMessage()); } catch(Exception $e) { die($e->getCode().':'.$e->getMessage()); } No error info, and neither does it get caught as an exception. Yet ...

MOOTOOLS calling sexy.error() from PHP

I am very inexperienced with PHP and I've having trouble calling a mootools function. Here's my code: echo '<script language="JavaScript">'; echo "Sexy.error('Test!');"; echo '</script>'; When viewing source code looks like this: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Ba...

How do I use pdo's prepared statement for order by and limit clauses(or can I?If not,what should I reference for a complete list of clauses where parameters can be used) ?

$sql = "SELECT * FROM table ORDER BY :sort :dir LIMIT :start, :results"; $stmt = $dbh->prepare($sql); $stmt->execute(array( 'sort' => $_GET['sort'], 'dir' => $_GET['dir'], 'start' => $_GET['start'], 'results' => $_GET['results'], ) ); I tried to use prepare to do the job,but $stmt->fetchAll(PDO::FETCH_...

Form in wordpress isn't reading all checkboxes on first submit

When submitting forms on a wordpress page with multiple checkboxes, on the first submit, when I print_r($_POST), the checkbox array shows two items without their values. Occasionally it works. Here's the code: <form action="<?php echo htmlentities($_SERVER['REQUEST_URI']); ?>" id="assessment-form" method="post"> <ul> <li> ...

showing surrounding page numbers

I've been doing some pagination recently and used the following: if ( $totalPages > $pagesToShow ) { $start = $pageNumber - floor($pagesToShow/2); $end = $pageNumber + floor($pagesToShow/2); while ( $start < 1 ) { $start++; $end++; } while ( $end > $totalPages ) { $start--; $end--; ...

Passing a URL as a URL parameter

I am implementing OpenId login in a CakePHP application. At a certain point, I need to redirect to another action, while preserving the information about the OpenId identity, which is itself a URL (with GET parameters), for instance https://www.google.com/accounts/o8/id?id=31g2iy321i3y1idh4&#51;q7tyYgdsjhd863Es How do I pass this d...

How to hide all buttons in IE6 without hiding all inputs in a printing stylesheet?

Hi guys, Whats the easiest method of hiding all buttons but not all inputs (say drop down lists, text input boxes) in CSS that works with IE6. The purpose of this CSS file is for printing (using the media="Print" tag in the HTML). ...

Surely a foolish error, but I can't see it

I have a form (greatly simplified): <form action='http://example.com/' method='post' name='event_form'> <input type='text' name='foo' value='3'/> <input type='submit' name='event_submit' value='Edit'/> </form> And I have a class "EventForm" to process the form. The main method, process() looks like this: public function process($...

How can I make a singleton wrapper for PDO?

How can I make a singleton of the PDO extention? Extending doesn't work, because I get a fatal error when I try it ... ...

What's a good test to compare performance of different Ajax frameworks?

I want to compare the performance of different PHP/Ajax frameworks. I'm not looking for tools to run the tests, I'm looking for what tests to run. I'm in the design phase of a project so I don't have an existing app. I'd like to build the same page in several different frameworks and compare things like the generated client-side code ...

MS outlook and PHP

It is possible with php create a script, and this script insert an appointment in outlook calendar. I search in internet but... I don't find a solution... I use php but if it is possible with JavaScript is the same. Thanks! ...

How to push a datetime var or a demical var to a .NET SOAP server using PHP?

I am sending all the parameters needed to the SOAP server, but they require one of the params to be a decimal and one to be a datetime. I can't figure out how to convert a string to either type. <?php $params = array( # this converts the string to an int 'int' => (int) '123', # to datetime is a big ? to me 'day' => date("n/j/Y...

way of pasting code snippets/blocks in gmail/wave/gdocs?

often i want to email some code without attaching a file, are there any gmail/google wave/gdocs plugins for code sharing? gmail would obviously be most useful! ...

How to store array data in MySQL database using PHP & MySQL?

I'm new to php and mysql and I'm trying to learn how to store the following array data from three different arrays friend[], hair_type[], hair_color[] using MySQL and PHP an example would be nice. Thanks Here is the HTML code. <input type="text" name="friend[]" id="friend[]" /> <select id="hair_type[]" name="hair_type[]"> <option ...

how to use ob_start?

Hello I am using PHPSavant templating system for a project and I am not sure how to use ob_start in this. I have tried before .. for example, page_header.php -- ob_start(); page_footer.php -- ob_end_flush(); But because now I am using a templating system.. am not sure where to put these function. $template = new Savant3(); $templ...

Loading dynamic external content into the Div of another on click

Trying to load an external php file into another onClick. Iframes will not work as the size of the content changes with collapsible panels. That leaves AJAX. I was given a piece of code HTML <a href="#" id="getData">Get data</a> <div id="myContainer"></div> JS $('#getData').click(function(){ $.get('data.php', { section: 'mySection...