Monday, 10 January 2011
Access violation at address 10002593 in Module 'LIBMYSQL.dll'
Access violation at address 10002593 in Module 'LIBMYSQL.dll'
Repeating the Error
Start WinMySQLAdmin with the xampp and you should get the error again.
Solution
1. Open WinMySQlAdmin
2. Click on the my.ini Setup tab
3. Change the following entries
user=root
password=password
to
user=
password=
Another simple solution is to locate my.ini in your windows directory and make the below changes:
user=root
password=password
to
user=root
password=
This should resolve the error. If not, let me know and I will try my best to get you another solution. :)
Generating XHTML MP (WAP 2.0) Pages From PHP
Maybe you guys know that I've been working on a service called MyWapBlog.com which lets peoples create/manage mobile blogs using their mobile phones. In the course of the development I've learnt great deal about mobile websites and their dynamic generation, and I'm sharing a bit of it here in this post.
How do you generate dynamic (X)HTML Pages using PHP? Simple:
Sometitle
Hello
echo date('h:i A, j-M-y'); ?>
And if you look at XHTML MP pages, their source look like the following:
...
...
So you see these pages have a different document type and some other differences. So will the following code work and generate a valid WAP 2.0 page?:
Sometitle
Hello
echo date('h:i A, j-M-y'); ?>
The answer is “NO”? Why? Because XHTML MP pages needs to be served with a different Content-Type than what is generated by .PHP files. Normally when you runa s PHP script and it outputs something, the content is served with Content-Type: text/html
What is Content-Type?
It is a header (information about a particular resource) returned to browser when it requests something from a server. When you request an image, the server return the image with the header image/png, image/jpeg etc. letting the browser know how the returned content is to be interpreted.
PHP scripts can return contents of any type (using the header() function), from text to images and PDFs to ZIPs. And therfore if we want to generate XHTML MP pages, it can even do that without doubt.
So what we need to do is, just change the above code a bit adding a new line at the top so that the whole code look like the following:
("Content-type: application/vnd.wap.xhtml+xml; charset=UTF-8");?>
Sometitle
Hello
echo date('h:i A, j-M-y'); ?>
This will tell the browser that the content we are going to serve is of the type XHTML MP. We always use the charset UTF-8 for these pages, which is also told to the requesting browser.
Now the big question is, why we didn't do this for normal HTML pages. Why didn't we have to tell the browser that content is of the type “text/html” when it was so? Because PHP does it for us! Yes whenever we output anything from PHP scripts, the PHP interpreter outputs the default header (text/html) automatically. Just as the PHP interpreter finds anything in the script that needs to be output, it first generates a header, the outputted content follows. For example in the first script, the very first line (very first character “<”) needs to be output to the browser. So before that, the PHP interpreter sends a content type header (default – text/html).
Therefore, when we had to output our content with a different header we had to make sure that it is done before PHP does it automatically. Two headers cannot be valid.
This is it for this post, do check back soon for more new posts. Till then, good bye!
Creating Tool-Tip Text for WebPages Using CSS Only
[You might also be interseted in Deigning a Simple HTML Menu-Bar Using CSS]
All right, so today we are going to use CSS along with some HTML to create Tooltip text for WebPages without using JavaScript. Yeah, you heard it right using only CSS and of course HTML. Do I need to explain what a Tooltip is, BTW? Nah, you guys already know it. I do not think many sites use tooltips or anything of that sort on their websites but in case you do or you just want to learn, read on…
Well, the first thing that I want to tell is that the basic technique I’ll be using to create tooltips is not mine, I saw someone using it for a slightly different purpose, I changes it to suite mine. As I said earlier we’d be using CSS and HTML only, I guess HTML is easier so here it is:
href="#" class="tooltip">Hover Here>This is the Tool-Tip Text>>
As you can see there is nothing special, a plain simple link but wait what is that for? Good question! Well the text under the tag wouldn’t be visible unless you hover the mouse over the link. When you do so that’d become visible, neatly formatted to look just like a real Tooltip text. But how? You might ask. It has been classified (class="tooltip") to do so.
The heart of all this is the CSS:
a.tooltip{ /* for postioning the tool-tip box relative to the link */ position:relative; /* no underline needed */ text-decoration: none; } a.tooltip span{ /* tool-tip text will not be visible initially */ display: none; } a.tooltip:hover span{ /* make tool-tip text visible */ display:block; /* for postioning */ position:absolute; top:20px; left:20px; padding: 5px; /* width of the tool-tip box if text is longer, it will be made into two lines */ width:150px; /* style the box to look like a tool-tip box */ border:1px solid #000; background-color:#FFFFAA; color:#000; } Now to make it more clear, I’d break the whole code into smaller pieces and discuss what that does:
1. a.tooltip { position:relative; }
This would make the tooltip (whenever) it appears to be positioned relatively to where the link is.
2. a.tooltip span { display: none; }
It’d (as you might have guessed) make the tooltip text (or the tag) to be invisible.
3. a.tooltip:hover span { display:block; position:absolute; top:20px; left:20px; padding: 5px; width:150px; border:1px solid #000; background-color:#FFFFAA; color:#000; }
This defines what the tag would be when mouse is hovered over the link.
First it’d make the visible (thus the tooltip text) by using display: block;. Next it’d position and style the text to look like a “Real” tooltip.
Easy! Now it is…
Here is the complete code:
> > >ToolTip Text Example> > a.tooltip{ /* for postioning the tool-tip box relative to the link */ position:relative; /* no underline needed */ text-decoration: none; } a.tooltip span{ /* tool-tip text will not be visible initially */ display: none; } a.tooltip:hover span{ /* make tool-tip text visible */ display:block; /* for postioning */ position:absolute; top:20px; left:20px; padding: 5px; /* width of the tool-tip box if text is longer, it will be made into two lines */ width:150px; /* style the box to look like a tool-tip box */ border:1px solid #000; background-color:#FFFFAA; color:#000; } > > > href="#" class="tooltip">Hover Here>This is the Tool-Tip Text>> > > Saturday, 9 October 2010
PHP Tutorial: Writing A Feedback Form Script Getting Started with PHP: Write a FormMail Script in PHP
PHP Tutorial: Writing Your First PHP Script: Feedback Form Script
by Christopher Heng, thesitewizard.comI have always believed that the most fun way to learn a new programming language, whether it is a language like C or a scripting language like PHP, is to use it to write a real-life useful program. Of course this is not the most systematic method of learning, but it works well if you already have some background in programming.
Preliminaries
Before you write your first PHP program, make sure that that your website is running on a web host that runs PHP 4.1 or above.
You may also find it useful to have a copy of PHP 4.1 or later installed on your own computer. This makes testing your PHP scripts much easier. If you use Windows, you can find some tips on installing PHP on your own computer from my article on "How to Install and Configure PHP 5 to Run with Apache on Windows" at http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml
And of course, you will need an ASCII text editor of some kind (such as Notepad on Windows). There's a list of such editors on http://www.thefreecountry.com/programming/editors.shtml
This tutorial also assumes that you have at least some knowledge of HTML. This is necessary because if I have to explain all the HTML tags as well, this tutorial will end up being tediously long.
You'll probably need a bit of programming background, or at the very least, an aptitude for computer programming. Note that being able to code in HTML does not count, since HTML is not a programming language. Unlike the majority of the other articles on thesitewizard.com, this article is not targeted at the absolute newcomer. You really need background in both web design using HTML and a bit of programming skill/aptitude, otherwise this article will be indecipherable. If you are reading this article because you want to create a website, please start with How to Make / Create Your Own Website: The Beginner's A-Z Guide instead.
I will begin with a very rudimentary (but working) PHP script to take input from a feedback form and send it to you in an email message. This type of form is sometimes referred to as a FormMail or Form to Mail script. In later articles, I will develop that script (and others) to include features commonly found in such FormMail scripts.
If you are programming-savvy, you will recognize this as a sort of "Hello World" program, but infinitely more useful!
Writing the Feedback Form
The first thing we need to do is to write the feedback form itself. Put the following code in the
section of an HTML file named, say, feedback.html. Basically the form asks the visitor for his email address (the field named "email" found in input name="email" above) and message (the field named "message" found in textarea name="message"), and presents him with a button which he can click to submit the contents of the form. When the form is submitted, it is "posted" (see the "method" attribute of the