php

What is the difference?

I try out CakePHP. I follow this Tutorial and can't find out why this code doesn't work. The code from the tutorial works fine. echo $html -> link('Löschen', array('action' => 'delete', 'id' => $post['Post']['id']), null, 'Sind Sie sicher?' ); ...

Is there a way to access a PHP class method using JavaScript through jQuery?

I have a JavaScript script: $("#feedbacksubmit").click(function() { if($("#frmfeedback").valid()) { var tname = $("#name").val(); var temail = $("#email").val(); var tphone = $("#phone").val(); var tcontent = $("#content").val(); var tsend = $(this).attr('ts'); $.post ( "bll/index...

Is there a solution for pdf template in PHP?

I need to generate quotes in pdf format by PHP, with a template and dynamic values retrieved from database. is it viable ? ...

Remove an empty directory from a ZIP file with PHP

PHP brings a class for ZIP file manipulation. It also allows the creation of directories with addEmptyDir() and the deletion of an entry with deleteName(). But the deletion does not work on directories (empty or not). Is there any way to delete empty folders in a ZIP file (prefered is buildin PHP functionality)? ...

ckeditor file browser

I've lost the link to free file browser which can be integrated with ckeditor. It has the number '4' and .NET in the title and it's written in PHP. Does anyone know the name of this program? ...

Searching a table MySQL & PHP.

I want to be able to search through a MySQL table using values from a search string, from the url and display the results as an XML output. I think I have got the formatting and declaring the variables from the search string down. The issue I have is searching the entire table, I've looked over SO for previous answers, and they all see...

Logged out from one tab. User should logged out from other tab.

I am using jqury ajax call to update data. I logged in in two different tabs in firefox. I logged out from one tab. The second tab is not yet refreshed. When i tried to update data through ajax call the call executed properly. How do i catch the user is logged out and display error while executing the ajax call. ...

Overriding Magento Admin Controller, for Beginners

In the Magento Admin section, I want to override the "Sales/Order/ShipmentController.php" controller file of the core Mage. I have tried rewriting the URL, using the "from" & "to" tags, but in vain. I don't know what is the actual & correct way of doing this, as I'm a newbie in Magento. Please anybody provide some good fundamental & co...

Does UNIX time record Timezone?

I want to ask about UNIX time, Does UNIX time record Timezone? I moved my hosting from Chicago/America to JST. The problem is that my whole MySQL database has records of UNIX time (Chicago/America timezone) I have a PHP code to show the time ago (ex 3days ago, yesterday, etc) When I move to the new server it says tomorrow To avoid th...

Replace repeating character with array elements in PHP

I hope this is blindingly obvious: I'm looking for the fastest way to replace a repeating element in a string with the elements in a given array, e.g. for SQL queries and parameter replacement. $query = "SELECT * FROM a WHERE b = ? AND c = ?"; $params = array('bee', 'see'); Here I would like to replace the instances of ? with the cor...

explode is not working to split string

we unable to split the string following code.please Help us. <?php $i=0; $myFile = "testFile.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "no\t"; fwrite($fh, $stringData); $stringData = "username \t"; fwrite($fh, $stringData); $stringData ="password \t"; fwrite ($fh,$stringData); $newline ="\r\n"; fwrite ($...

what is the exact difference between PHP static class and singleton class

I have always used a Singleton class for a registry object in PHP. As all Singleton classes I think the main method looks like this: class registry { public static function singleton() { if( !isset( self::$instance ) ) { self::$instance = new registry(); } return self::$instance; }...

Reporting sanitized user input to the user via AJAX

I am writing some code to give live feedback to the user on the validation of a form using AJAX. I have got it checking length and if the field is empty. Now I want it to sanitize the users input and if the sanatized input differs from the users original input then tell them which characters are not allowed. The code I have written so f...

How to get values of xml elements?

Hi, I have some xml data and I am trying to access some elements. The structure of data is as below (using print_r($data)). I can get $data->{'parent'}->title, it works but if I try to get value of href using $data->{'parent'}->link[0]->{'@attributes'}->href .. it doesnt work .. any ideas? Thanks SimpleXMLElement Object ( [@attr...

PayPal testing without using Sandbox

I am developing a website in PHP that accepts PayPal payments. It uses the IPN from PayPal and has a custom payment template etc etc. It all works great through the Sandbox server but when it comes to showing my client, I don't want to have to tell them to login to/create a Sandbox account, create a buyer account and make a payment - h...

Weird insert behavior with mysql and codeginiter

I have a fairly simple insert statement <...> if (!empty($attributes)) { $sql = 'INSERT INTO `part_attrs` (`part_id`, `attr`, `type`, `list_order`) VALUES (?, ?, ?, ?)'; foreach($attributes as $key => $attribute) { $this->db->query($sql, array($partid, $attribute[0], $attribute[1], $key)); ...

PHP or MySql error; Possible to display an "error page" in browser?

My classifieds website uses mainly PHP and MySql. On error, (for example if a variable isn't found), I would like to have an error-page to show, is this possible? And I mean for every error to point to the same error-page. I am thinking about htaccess, but maybe there are other ways also? Same with MySql, how is it done there? Thanks...

PHP: ORM framework or library that I can use with my database table structure

Hi, I was using KohanaPHP ORM but I can't use it with my database table structure. So, I need a framework or library ORM to use with it. With Kohana I need to follow a naming convention. I can't use a field name (foreign key) like 'idUnidadeMedida'. Are there any suggestions? Thank you. ...

Get second to last value in array

I'm frequently using the following to get the second to last value in an array: $z=array_pop(array_slice($array,-2,1)); Am I missing a php function to do that in one go or is that the best I have? ...

Skip first regex match

Hi, Is there anyway to skip the first match when using regex and php. Or is there some way of achieveing this using str_replace. Thanks UPDATE I am trying to remove all the instances of a string from another string but I want to retain the first occurance e.g $toRemove = 'test'; $string = 'This is a test string to test to removing t...