php-5.3

PHP PDO with Special Characters

♀尐吖头ヾ 提交于 2020-01-01 11:53:27
问题 I am using PDO for MySQL database connection, selecting, updating and deleting. But I have a problem with selecting rows with special characters , for instance, I want to select a page title with 'Judge-Fürstová Mila', Table page , id title content 1 Judge-Fürstová Mila xxx SQL, SELECT * FROM page WHERE title = 'Judge-Fürstová Mila' Returns result if I query via phpmyadmin. But it return 0 with PDO, $sql = ' SELECT * FROM page WHERE title = ?'; $items = $connection->fetch_assoc($sql,'Judge

how to sum the array time [closed]

ぃ、小莉子 提交于 2019-12-25 20:06:22
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have an array like this. I need to add the total length of time in all the occurances of the array. so in the example below it will be 00:04:03 + 00:06:03 = 00:10:06 Array ( [4894] => Array ( [0] => Array (

windows update PDO SQL Server driver issue

感情迁移 提交于 2019-12-25 07:29:52
问题 I am using PHP in windows apache environment for connecting sql server using pdo. My code was running perfectly with out any errors. recent update on windows machine making pdo insert query not working. To confirm this error is not because of recent changes, I have reverted to older versions from SVN. Still same error exists. error is INSERT INTO contactus(contactref, title, first_name, last_name, email) VALUES('35008679022', 'Mr', 'Robin', 'Michael', 'robin@robin.com') The above query

PHP filter_var: How to make sure the user provides correct data types - true or false only

筅森魡賤 提交于 2019-12-25 05:22:29
问题 I want to compare two arrays, one is set by default and another by user input. When I have set a boolean value only in the default so I want to make sure the user won't use string or number. for instance, 'truex' or '1' is not acceptable. Below is my sample of code, $default = array( "randomise" => false, "id" => null ); $config = array( "randomise" => truex ); function process_array($default,$config) { # Loop the array. foreach($default as $key => $value) { if ((filter_var($default[$key],

Warning: include failed to open stream: No such file or directory in magento helper

淺唱寂寞╮ 提交于 2019-12-25 03:29:26
问题 I have created the following config.xml file: <config> <global> <helpers> <awesome> <class>CommissionJunction</class> </awesome> </helpers> </global> </config> I have added the following php file: as Data.php <?php class CommissionJunction extends Mage_Core_Helper_Data { /** * Get SKU, quantity, price and discount amount for each product in a given order * @param object $order * @return array */ private function _getOrderProductsList($order) { $orderItems = $order->getAllItems();

How to convert an empty array and empty object to an empty string or null

一世执手 提交于 2019-12-25 02:34:10
问题 How can I convert an empty array to an empty string or null ? $empty_array = array(); var_dump($empty_array); result, array(0) { } Also for an empty object below, class null_object{}; $null_object = new null_object(); var_dump($null_object); result, object(null_object)#4 (0) { } I am after null or just something like $empty_array = ''; whenever they are found empty. 回答1: What about this: function convert($array) { return (count($array) === 0) ? "" : $array; } $empty_array = array(); $empty

Why is PHP still displaying errors?

元气小坏坏 提交于 2019-12-24 11:36:04
问题 Recently upgrading to PHP 5.3 has resulted in a slew of depreciation errors being shown on my pages. In php.ini I have display_errors off and error_reporting = E_ALL ^ E_DEPRECATED, but the errors still show. Ideas? 回答1: Your script could be setting the error reporting level differently. Preferably at the end of the page that's having problems run: phpinfo(); It will give you the global, and local values for display_errors. It's likely been turned on at some point. If you establish that it's

Parsing HTML in Cakephp

情到浓时终转凉″ 提交于 2019-12-24 10:56:23
问题 I started building a web crawler in CakePHP 2.2. The pages, the script is crawling is HTML pages, and I need to parse them, to get my values. Have tried some different solutions, and looked on some open source things aswell, but not sure what the best way is to do this. DomDocument::loadHTML() - Looks like this is the solution but not 100% sure. Regular Expression - A bit hard to maintain Simple HTMLDom - http://electrokami.com/coding/simple-html-dom-baked-cakephp-component (Made for Cake 1.3

filter_var_array() multidimensional array

流过昼夜 提交于 2019-12-24 05:35:27
问题 Any ideas why this does not work? $_POST = array('edit' => array('name' => 'test')); die(var_dump( filter_var_array($_POST, array( 'edit["name"]' => FILTER_SANITIZE_STRING, 'edit[name]' => FILTER_SANITIZE_STRING, )), $_POST )); How can I sanitize/filter a POST parameter while requiring that it is an array ? 回答1: Didn't know that filter_var_array() does not support recursion. Don't see no reasons why it shouldn't, though. Here is a simple solution: // 28 01 2010, Gajus Kuizinas function hp

Strange error on increasing memory limit

折月煮酒 提交于 2019-12-24 03:42:16
问题 I am using a shared hosting environment and the default memory limit for PHP is 32M. I am facing some problems with Concrete5 setup. When I try to sign into the admin panel of Concrete5, it gives memory limit error Allowed memory size of 33554432 bytes exhausted . So I increased the memory limit with ini_set('memory_limit', '128M') to 128M . After this I get an error that says: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. I tried lowering the