Hi have the following content within an html page that stretches multiple lines
Heading 1
Tag: php
Formulas to Calculate Geo Proximity
I need to implement a Geo proximity search in my application but I’m very confused regarding the correct formula to use. After some searches in the Web and in StackOverflow I found that the solutions are: Use the Haversine Formula Use the Great-Circle Distance Formula Use a Spatial Search Engine in the …
Doctrine – How to print out the real sql, not just the prepared statement?
We’re using Doctrine, a PHP ORM. I am creating a query like this: and then in the function I’m adding in various where clauses and things as appropriate, like this Later on, before execute()-ing that query object, I want to print out the raw SQL in order to examine it, and do this: However that on…
The first day of the current month in php using date_modify as DateTime object
I can get the Monday of this week with: I would like to get with the same ease the 1st of this month. How can I achieve that? Answer Requires PHP 5.3 to work (“first day of” is introduced in PHP 5.3). Otherwise the example above is the only way to do it: In PHP 5.4+ you can do this:
Download of .zip file runs a corrupted file php
I’m trying to force a download of a protected zip file (I don’t want people to access it without logging in first. I have the function created for the login and such , but I’m running into a problem where the downloaded file is corrupting. Here’s the code I have: Here’s the error…
HTML coding and mixing of PHP or JavaScript code
I am assigned a task to revise a website and at present, I am working on index.html page. the previous coder has mixed a lot of JavaScript and CSS code in between and it is becoming difficult to read. …
Extract link attributes from string of HTML
What’s the best way to extract HTML out of $var? example of $var I want example: preg_match(); what else? Answer Instead of crafting long complicated regex, do it in steps one way of “non regex”, using explode
free lightweight template system
Is there any free, lightweight, non-MVC template systems made pure with PHP? I’m not interested in Smarty. Answer Sure:
Php SQL Server table value parameter
I am using php against SQL Server 2008 using the mssql driver. Anyone know of a way to pass a table value parameter into stored procedure? Answer Table-valued parameters are not yet supported by the PHP MSSQL Driver. You’ll have to try something else, like converting your TVP into XML and passing it as …
Output text file with line breaks in PHP
I’m trying to open a text file and output its contents with the code below. The text file includes line breaks but when I echo the file its unformatted. How do I fix this? Thanks. <…