March 23, 2010 at 1:21 pm (html)
Tags: difference between table and div base
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
March 20, 2010 at 12:35 pm (mysql)
Tags: datedff, mysql compare dates, to_days
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.
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.
the above returns 734217 as day number.
consider the queries,
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
March 9, 2010 at 1:17 pm (Wordpress)
Tags: 404 error in custom page, custom form posting, wordpress custom page
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 .
<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.
March 9, 2010 at 6:48 am (PHP)
Tags: image cannot displayed
I am displaying image using below code
header('Expires: ' . date('r',time() + 864000));
header("Content-Length: " . strlen($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.
March 4, 2010 at 7:36 am (books)
Tags: expert php & mysql, php book
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:
- Techniques Every Expert Programmer Needs to Know
- Advanced PHP Constructs
- MySQL Drivers and Storage Engines
- Improved Performance through Caching
- Memcached MySQL
- Advanced MySQL
- Extending MySQL with User-defined Functions
- Writing PHP Extensions
- Full Text Search using SPHINX
- Multi-tasking in PHP and MySQL
- Rewrite Rules
- User Authentication with PHP and MySQL
- Understanding the INFORMATION_SCHEMA
- Service and Command Lines
- Optimization and Debugging