error

error

Drupal 6 Upload Module Reference Warnings

Monday, May 16, 2011 - 17:26

I was testing out a new Drupal project build and found this strange error when uploading files to nodes using the Upload module. This error produced a lot of warning messages that appeared on the screen (in the process alarming my project manager) but apeared to have no impact on the actual function of the module, or the file uploaded. Essentially, when a file was uploaded the following errors were produced.

Category: 

PHP Question: Print Object

Thursday, April 28, 2011 - 12:29

Question

The following code was executed.

1
2
3
4
5
6
7
<?php
class MyClass {
  private $foo = "bar";
}
 
$myObject = new MyClass();
echo $myObject;

Which produced the following error.

1
2
3
4
Catchable fatal error: Object of class MyClass could not be converted to string in test.php on line 7
 
Call Stack:
    0.0011     323736   1. {main}() /test.php:0

How can the code be simply changed to prevent this error and produce some form of result?

Category: 

Scroll To First Error Message On Page With jQuery And ScrollTo

Friday, January 29, 2010 - 10:25

If you have a large page or form that uses validation on it then you will probably want to tell the user that something is going on. One way to do this is by telling the user at the top of the page that something has gone wrong and then letting them figure out where.

A more elegant solution is to scroll the page down the just above the first error message so that the user is aware of what they need to fill in. This can easily be done through a combination of jQuery and the ScrollTo plugin.

Category: 

Convert A String To A Date Value In MySQL

Tuesday, April 21, 2009 - 14:49

There are numerous ways to print out dates and times, and many hours of programming are spent in converting dates from one format to another.

To do this in MySQL you use the STR_TO_DATE() function, which has two parameters. The first parameter is the time to be parsed and the second is the format of that time. Here is a simple example that converts one date format to a MySQL formatted date string.

Category: 

A Useful Error Controller Class For Zend Framework Applications

Tuesday, December 23, 2008 - 15:58

One useful function of any application is to report on any errors that occurred. Zend Framework comes with a nice error controller system that you can activate by creating an ErrorController class.

The following is an ErrorController class that I use. It detects what sort of error occurred and displays a message to the user. It will also email a detailed report of the error to the server admins.

Category: 

Quickly Run Any PHP Code Through A Form

Wednesday, October 15, 2008 - 13:54

NOTE: This bit of code is potentially very dangerous and should NOT be uploaded to your web host. I only use this function on my localhost to quickly check that a snippet of code works.

If you want to quickly run some PHP code, and don't want to have to go through creating a file just to see the outcome of a simple calculation is then this snippet might be of some use to you.

Category: