Skip to content

create DateTime string for the beginning and the end of the day

If I have a string of the following: and when I convert to a DateTime using the following function: it always gives me a DateTime with the time not set. I want to have two DateTime : one marking the beginning of the day, meaning at 00:00:00 another DateTime which is on the same date but at the end of

Project structure for PHP

I am new to PHP and want to know the directory structure for the php projects. I have experience in Java and in java we have src contains java source files, WEB-INF contains lib, and jsp pages. Do we …

Setting time zone in php

I’m using the following code to get server time. But I’m in Bangladesh and I don’t get Bangladeshi time by this. Please tell me where I have to change for the exact Bangladeshi time. $Vdate=date(“F j,…

Using PDO to CREATE TABLE

I am very new to php and this forum, so please excuse any errors or misplaced questions. In the code i provided, I am just looking to CREATE a Table in the DB “mydb”. I tested the connection to the DB(It works). It is just the creating the table i am having issues with. Any advice or criticisms wo…

Gettext will always use system default locale

I need to localise a Windows-only PHP web application and I’m evaluating the gettext extension but I’m having the hardest time trying to make it work in my Windows 7 development box. I’ve used trial and error together with Process Monitor to overcome the poor and inaccurate documentation and…

PHPExcel: Download the Excel file on the client side

The problem was solved: For other users that may have this problem – notice the encoding of the PHP file. If you use PHPExcel it must be ANSII encoding and not UTF8, otherwise the EXCEL will be downloaded corruptly. The Headers that were added (answer 1) solved the problem after i changed the encoding o…

Creating a very simple 1 username/password login in php

I want to make a single login for just 1 user without storing in a database but I can’t seem to get this to work. My code: login.php trylog.php Answer Your code could look more like: Now, when the page is redirected based on the header(‘LOCATION:wherever.php), put session_start() at the top of the…