background preloader

Tech

Facebook Twitter

AppleScript

Enumeration - PHP and Enums. Introduction To PDO - PHP Tutorials. File Create. Before you can do anything with a file it has to exist! In this lesson you will learn how to create a file using PHP. In PHP, a file is created using a command that is also used to open files. It may seem a little confusing, but we'll try to clarify this conundrum. In PHP the fopen function is used to open files. However, it can also create a file if it does not find the file specified in the function call.

So if you use fopen on a file that does not exist, it will create it, given that you open the file for writing or appending (more on this later). The fopen function needs two important pieces of information to operate correctly. Since we want to create a file, we must supply a file name and tell PHP that we want to write to the file. $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); The file "testFile.txt" should be created in the same directory where this PHP code resides.

Learn to code. Transactions and auto-commit. Now that you're connected via PDO, you must understand how PDO manages transactions before you start issuing queries. If you've never encountered transactions before, they offer 4 major features: Atomicity, Consistency, Isolation and Durability (ACID). In layman's terms, any work carried out in a transaction, even if it is carried out in stages, is guaranteed to be applied to the database safely, and without interference from other connections, when it is committed.

Transactional work can also be automatically undone at your request (provided you haven't already committed it), which makes error handling in your scripts easier. Transactions are typically implemented by "saving-up" your batch of changes to be applied all at once; this has the nice side effect of drastically improving the efficiency of those updates. Unfortunately, not every database supports transactions, so PDO needs to run in what is known as "auto-commit" mode when you first open the connection.

Warning. PDO Fetch Class. In this tutorial we will study about PDO Fetch Class method in PHP, how to access MySQL using PDO Fetch Class method , How to retrieve data etc. Examples will make this clearer. PDO Fetch Class: Using PDO::FETCH_CLASS we can map the fields of a table as properties (fields/variables) of a class. With the help of this method we can achieve greater speed because the mapping activity is done internally. As illustrated in the following example we can see that we have declared a class and a method called first_cap (which is used to change the first alphabet in capital form ) and in the following part an object is declared as the object of this class and by calling this method we can change the first alphabet of the field last_name, you can use any other method, field.

Example: <? Class employee public function first_cap() return ucwords($this->emp_last_name); $host='localhost'; $user='root'; $pass=''; try{ $dbh=new PDO("mysql:host=$host;dbname=ajax",$user,$pass); echo "connected<br/>"; $dbh=null; Output: PDOStatement->fetch. Php - Looking for a some good options to send users reset password emails. Sending Nice HTML Email with PHP. This is going to be a continuation of the Website Change Request Form demo we've been using around here for a while. If you need to catch up, first I talked about it, then I built it, then I screencasted it, then I secured it. Throughout all of this, the end result has been a boring text-only email that gets sent to a single email address. We're going to improve that output, and make the email into a nicer looking HTML-formatted email.

It's Not Much Different Than Text Email Sending HTML Email through PHP uses the exact same mail function as text email: mail($to, $subject, $message, $headers); The last parameter, the headers, are optional for the function but required for sending HTML email, as this is where we are able to pass along the Content-Type declaration telling email clients to parse the email as HTML. In fact, the headers area gives us the opportunity to do lots of important email functions. Now We Can Use HTML Tags $message = '<html><body>'; $message .= '<h1>Hello, World! Concerns. How to Code HTML Email Newsletters Article. This article was first published in 2006, then re-edited in 2011 — and it’s still one of our most popular posts.

If you’re keen to learn more about styling HTML email campaigns, head to our recent post on creating email signatures. HTML email newsletters have come a long way since this article was first published back in 2006. HTML email is still a very successful communications medium for both publishers and readers. Publishers can track rates for email opens, forwards, and clickthroughs, and thereby can measure reader interest in products and topics; readers are presented with information that’s laid out like a web page, in a way that’s more visually appealing, and much easier to scan and navigate, than plain text email.

In some ways, coding HTML email has become easier — several email software providers, such as Google Mail, have improved their support for CSS. Despite these advances, coding HTML email can be a mix of misery and pain for programmers. HTML Email Fundamentals. Using CSS in HTML Emails: The Real Story. Should you be sending HTML emails at all? This is surely a debated issue, but ultimately I say if you have a message you feel would benefit from a nicely designed email you should go for it. If you just want to do it because everyone else on your block is doing it too, don't. If you decide to do it, these are what I consider to be the five golden rules of HTML emails: Only send email to people that opted to receive them.Make sure to create it so that it looks the best it possibly can in all email clients.Don't overdo it.

Weekly is probably too often.Send a plain text alternative.Offer and opt-out link and honor it. WRITE your email before you design it The first thing you should do is to write the plain-text version of your email. Couple quick tips for your plain-text email: Hard-wrap your lines at 60 characters and write out full URL's instead of using anchor tags.

Design for the lowest common denominator first. What you CAN'T do: Include a <head> section with styles. What you CAN do. Help! Code Snippets - Snipplr Social Snippet Repository.

Javascript snippets

Web. 3d Art & Design. Validation. GeekTool. Writer's Café fiction writing software - novels - screenwriting - short stories - creative fun. For Business. AtariArchives.org - archiving vintage computer books, information, and software. Mac. Web design. Computer art.