Archive for the 'PHP & MySQL' category

Pagination Class. PHP

May 14 2013 Published by under PHP & MySQL

Pagination is frequently used on displaying large lists that are too big to be displayed on a single page.

As a solution of displaying large lists is

  • Splitting the list into small portions.
  • Displaying one list portion per page.
  • Setting up a menu with possibility to navigate between pages.

Pagination menu coding is a time consuming job.

Continue Reading »

No responses yet

PHPMyAdmin Custom Columns Export

Mar 18 2013 Published by under PHP & MySQL

How to export one column of the same table, multiple columns (but not all) of the same table, multiple combined columns from different tables, just some data of mysql search result.

Continue Reading »

No responses yet

Merge MySQL Database Tables

Mar 03 2013 Published by under PHP & MySQL

In a script I administrate mystically disappeared part of data. Since php script is zend encrypted it is difficult to find out why data were lost, but anther problem is restoring data.

Continue Reading »

No responses yet

MySQL Generate Random String, Email Address, URL

Feb 27 2013 Published by under PHP & MySQL

Testing functionality of a php program you will need a populated mysql database.

MySQL database is possible to populate without involving any third party scripting, by mysql own inbuilt functions.

Continue Reading »

No responses yet

Cpanel include PEAR Library. Configure Path

Oct 14 2012 Published by under PHP & MySQL, Tricks

I have recently faced a problem, a website of mine was using PEAR DB.php library.
On a linux server without WHM or Cpanel it’s not a problem (at least for me) to configure paths and include PEAR libraries into php scripts just by name:

include_once('DB.php');

For cpanel based servers this include won’t work unltil you install your PEAR lilbraries and tell your local php configuration where the PEAR library is.

Continue Reading »

No responses yet

PHP. Protect File From Unauthorized Access

Oct 12 2012 Published by under PHP & MySQL, Tricks

Selling downloadable products you perhaps faced a problem: Unauthorized download.
You upload a file, sell it several times, then notice that your file is being accessed by much more people than it was expected to.

As a solution you can send file through email, but in nowadays many people expect instant download, so refunds will start bothering you.

In fact there is a rather simple php solution allowing downloads to authorized people only.

Continue Reading »

No responses yet

PHP. PDF File Download

Oct 12 2012 Published by under PHP & MySQL, Tricks

You have a pdf file with some informative info to share with your website users.

HTML Anchor, PDF File Download

Link your .pdf file into html code:

<a href="path_to_file/filename">download my file</a>

path_to_pdf_file – pdf file URL or relative path;
filename – your pdf file to download;

How does this work? Say your file is pdf, text, word, excel format… User’s browser automatically detects file type and display the file content to your users.
Now, to save this file they should click the right mouse button and select Save from the drop down menu.

But, what if you wish users download your file…

Continue Reading »

One response so far