How do i round up the value up to 2 decimals in PHP
iam doing division of these two columns $row['col1']/$row['col2'] iam getting value as 0.0042553191489362 How do i round up the value so that i can get as 0.42% ...
iam doing division of these two columns $row['col1']/$row['col2'] iam getting value as 0.0042553191489362 How do i round up the value so that i can get as 0.42% ...
so here's a cut down version of my code: class lookAClass { public $pageTitle; public function add() { $tmp = 'just some filler text <[pageTitle]> and some more text'; echo preg_replace_callback('<\<\[(.*)\]\>>', array( } private function parseAdd($matches) { return $this->$matches[1]; } } $main = new lookAClass(); $m...
The PHP manual for split() says This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged...Use explode() instead. But I can't find a difference between split() and explode(). join() hasn't been deprecated, so what gives? ...
want to get a validation script to validate the file upload box onsubmit. check the extension of the file and validate accordingly to the extension of file loaded ...
hello .. i'm trying to load remote xml file using php .. this is the function : $doc = new DOMDocument(); $doc->load($this->xml_file); $file = $doc->getElementsByTagName('file'); $totalFiles = $file->length; echo $totalFiles; and the remote xml file link is : http://localhost/script/index.php?act=xml which this ...
I am having a strange problem. I am using PDO prepared statement. I have two tables with the name of TABLE1 AND TABLE2. TABLE1 is copied from another db with its data. TABLE2 is created using phpmyAdmin, Both Tables are in the same Database. I am running a Select statement using PDO prepare and its working fine on TABLE1 (which is...
Here is how I am getting an identity from a database: $adapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('dbAdapter')); $adapter->setTableName('clients'); $adapter->setIdentityColumn('email'); $adapter->setCredentialColumn('password_hash'); // etc $client = $adapter->getResultRowObject(null, array('password_hash')); Zend_Sessi...
Hi , am rendering around 3000 records , So row like Customer Profile edit Customername , Action 1 john editimage | Delete image 2 john editimage | Delete image 3 john editimage | Delete image 4 john editimage | Delete image 5 john editimage | Delete image ... ...
Hello, everybody! I have a new question about Kohana 3, or rather about a module structure. I develop a small module called Textblock. It's about an ordinary page or a small insertion to the site layout (e.g. a greeting or a slogan, company name). It contains both controllers and models. Models inherit Sprig_MPTT. And one feature I'd lik...
I want to transfer 10 user details from my server database to another server.The other server can call a php page (in my sever) which can supply the needed 10 user details.This should happen in such a way that a user using the site must not understand that the data is coming from another server. Can anyone help me ou ...
Hi all, As the title explains, I want to maintain an information across requests from multiple clients. Let me put in a simple example to explain what I want. This example is just for illustration of my question and not the purpose of the post. Example: I want to count the total number of requests that a server has had so far fr...
How can I add a class to the active navigation link? If a link points to URI /index/index and the request URI is also /index/index, I would like the link to have class, for example: <li class="active"> <a href="/index/index">Index</a> </li> This is how I am initializing navigation in the bootstrap: protected function _initNavigat...
I'm trying to allow users to upload large files (64MB) and am planning to change: upload_max_filesize to 64MB However, should I also change memory_limit to 64MB or larger? Is memory_limit connected to max_filesize? ...
Hi, How can be disable exception messages on the production website and keep them in dev? Example: try{ //some code } catch(Exception $e){ echo $e.getMessage(); } Edit: How it done on Zend Framework? (.ini file but what about exception code that should be write?) Edit 2: If my example can't work how zend framework disabl...
Hi, Does empty() function validate all of this cases: 1.var=null 2.var=empty string ""/" " 3.var=not set Example for validate use (Should I add some more code for validation or empty() enough?): if(!empty($userName)){ //some code } else{ echo "not valid user name" } Edit: should isset() used before empty() or empty() ...
Im working with PHP5, and I need to transform XML in the following form: <list> <item label="(1)">some text</item> <item label="(2)"> <anotherNode>some text</anotherNode <item label="a">some text</item> <item label="b">some text</item> </item> </list> Into something like this: <lis...
I have the following script to take an uploaded PDF in PHP and call ImageMagik/Ghostscript to convert to images of specified size. $tmp = exec("convert \"{$strPDF}\" -resize 500X500 \"{$strOut}\"", $results); However, this doesnt seem to work. No errors in the log file and no errors on screen. If I do the following, $tmp = exec("con...
I have form with Tinymce. I am saving text writen in tinyMce using ajax call. when I press the save button it does not save the latest value which i entered in tinymce. i.e. when i load the page, default value in the field is "aaaa". I update it to "bbb" and press the save button. but it saved the value "aaaa". Now I change the value ...
<div class="plugin-block"> <h3><a href="http://wordpress.org/extend/plugins/sailthru-triggermail/">Sailthru</a></h3> **Intergrate Sailthru API functionality into your WordPress blog.** <ul class="plugin-meta"> <li><span class="info-marker">Version</span> 1.0</li> <li><span class="info-marker">Updated</span> 20...
i ave been having trouble with a simple select sql query. using php PDO. for some reason the rowcount returns 1 but fetch and fetchall both return false; to me that means the execute failed or the query returned no results which would have a rowcount of 0. my sql syntax as far as i can tell is fine. here is the sql query SELECT * FROM...