Skip to content

Tag: php

How do I truncate a decimal in PHP?

I know of the PHP function floor() but that doesn’t work how I want it to in negative numbers. This is how floor works This is what I WANT Is there a PHP function that will return -1234? I know I could do this but I’m hoping for a single built-in function Answer Yes intval

getting value of with $_POST gives text

So, I’m retrieving these options from a database and I need to retrieve the value but I’m getting the text in between the tags by doing this therefore if I print $inst I get the “IUTIRLA” for the first option but I need the 41 I don’t know what I’m doing wrong… this i…

onclick not loading iframe

Here is the JS I am using This is in the head of the document. I have made a sidebar containing links: I have a target frame as: It works when I click the top level link, Sales in my case, the relevant document gets displayed in the target frame, but as soon I navigate to submenu links, its get

Download a file with an ajax call

I am using PHPExcel to read an excel template, populate the data, and ask the user to download the file. generate_excel.php When I open generate_excel.php directly from the browser, the result file is downloaded. But if I make an ajax call to the generate_excel.php, I don’t get the download prompt. Usin…

Difference between buffered and unbuffered queries

I was always under the impression the difference, in simple terms, between PHP/MySQL buffered and unbuffered queries is that buffered (the default) loads all the data into your results set variable and then you can start using them whereas unbuffered loads a row at a time. Say you ran SELECT * FROM sometable …