Difference between table and div tags

Tables are still quite acceptable for displaying layout elements that are in a tabular layout format, and in fact can be better than divs with such
layout. However, divs are more flexible for the same reason – they do not restrict the layout to tabular format. Instead, a div is like a “floating
box” that can be positioned anywhere you want.

Good web design specifies seperating content from presentation. That is, seperating the actual text of your site from it’s layout and style.

Tables have many problems, including being more difficult for those with disabilities to read, as well as making it more difficult for search
engines to find relevant information.

div/css based sites tend to get better page ranks in google and other crawlers because the site is “semantically” relevant. That is, you’ve
tagged parts of your page with bits of information that defines its importance, such as using h1/h2/h3 tags, etc…

Nothing is preventing you from designing sites as you always have, and 95% of your audience will probably never care. But if you want to be
accessible to those with disabilities (a requirement for government and educational sites, and a growing requirement for corporations – see the
Target Companies lawsuit), then semantic design is the way to go.

Another benefit is that div/css based sites tend to use a lot less bandwidth, which can save you real money if you pay per megabyte for your

Author: adeel hussain

Calculating Date difference using mysql functions

Today i am going to share two functions with you, one is datediff() and another is to_days() functions.

datediff(), accepts two parameters, both parameters can be either date or date_time. while comparing two dates, mysql takes only date parts for comparison, it will omit the time if the parameter is passed as date_time.

For example,

SELECT DATEDIFF(‘2010-03-21 23:59:59′,’2010-03-20’);

the above compare two dates and return 1

SELECT * from tablename where DATEDIFF(enddate,curdate())>1;

the above query compares enddate (is a field in the table, contains date value) and current date and returns rows whose enddate is greater than 1.

to_days(), accepts one parameters, and returns a day number.

For example,

SELECT DATEDIFF(‘2010-03-21’);

the above returns 734217 as day number.

consider the queries,

SELECT DATEDIFF(‘2010-03-21′),DATEDIFF(’10-03-21’);

this query returns 734217 for both. here mysql automatically converts two digit year into four digit year based on the rules designed in mysql server.

SELECT * from tablename where to_days(enddate) > to_days(curdate());

this query returns rows whose enddate is greater than today date

Author: Vinodkumar

404 pops after custom form submission by POST

I created a custom page template and added a form with few fields. When i submitted the form, i got the 404 error messages.  But when you submit the form without filling any fields it works charmly, and i found that its because of field name with “name” parameter .

For example,

<input type=’text’ name=’name’>

so i changed the ‘name’ to ‘username’ and its works perfectly.  Some of the keywords you should not use are “day,month, year”. If you use these keywords, you will get 404 error page.

I hope this will help others who have similar problem.

Author: Vinodkumar

the image cannot be displayed, because it contains error

I am displaying image using below code

header("Content-type: image/jpeg");
header('Expires: ' . date('r',time() + 864000));
header("Pragma: public");
header("Cache-Control: public");
header("Content-Length: " . strlen($contents));
echo $contents;

where $contents is getting from fread functions. Some days later the images are not displaying and i am getting the below errors

“The image <Route to imagescript.php> cannot be displayed, because it contains errors”

And after a long Google search, i found the solutions, May be this might be very helpful to others who have same issues.

If you have this problem. try to delete any space character between the begin of the script and the php tag <?php.
I spent several hours before realize this. And now it works OK. This happens because any character on the file alter the png format.

Upcoming book – Expert PHP and MySQL

This month will see the release of the book Expert PHP and MySQL which I was a co-author of. Initially this will be available for purchase in PDF format from the Wrox website and I am hopeful this will be available in print format for the MySQL Users Conference.

More then just your standard PHP and MySQL there is detailed content on technologies including Memcached, Sphinx, Gearman, MySQL UDFs and PHP extensions. We will be posting more information at www.ExpertPhpandMySQL.com. You can download a PDF version of Chapter 1 Techniques Every Expert Programmer Needs to Know.

The book includes the following content:

  1. Techniques Every Expert Programmer Needs to Know
  2. Advanced PHP Constructs
  3. MySQL Drivers and Storage Engines
  4. Improved Performance through Caching
  5. Memcached MySQL
  6. Advanced MySQL
  7. Extending MySQL with User-defined Functions
  8. Writing PHP Extensions
  9. Full Text Search using SPHINX
  10. Multi-tasking in PHP and MySQL
  11. Rewrite Rules
  12. User Authentication with PHP and MySQL
  13. Understanding the INFORMATION_SCHEMA
  14. Security
  15. Service and Command Lines
  16. Optimization and Debugging

« Older entries