Affichage des articles dont le libellé est MySQL. Afficher tous les articles

Using Flash, php and MySql / PDF


 Using Flash, php and MySql / PDF








Sample of the pdf document :









A typical Flash application, like a simple HTML web page, does not collect and store data on the server computer.  To store information, you need to use a file or a database and connect to the file or database using so-called server-side or middleware software.  Similarly, a typical php application accepts form data from a HTML form and produces an HTML document. This example demonstrates using Flash and php to store data in and extract data from a MySql database.  Both php and MySql are considered Open Source tools. 

The application keeps track of votes cast for 4 choices.  It is intended to represent a polling application, not a voting application.  Please note that a real voting application would need to incorporate features to allow only legitimate voters to vote and to only vote once.  A debate is going on now concerning various systems for electronic voting.  One feature considered critical by many, though not all, is that the system produce a paper trail for each vote.  This toy application does not include any of these features.  The intent is to demonstrate how Flash can connect to a php script.

Before continuing, one more warning:  A basic contract with an Internet Service Provider generally would not include support of php scripts or MySql (or any other) database.  This application and tutorial assumes php and MySql support and, moreover, assumes that a table has been created and initialized to hold the polling data. 

It is assumed that the reader has some background using Flash.  This document will explain the features of the application, not give step-by-step instructions on how to replicate it.

The initial screen for the Flash interface is the following:

If the person responds by clicking on the radio button next to Other and then Submit vote, the following screen results (at this point for this application.  I do not know where these 'votes' came from—perhaps my students).


The Flash interface consists of
  • the static text field with the words "If you had to vote today, would you vote for …."
  • 4 radio button components
  • 1 push button component
  • A dynamic text field, marked as accepting HTML tags and with a boundary

There are two layers: one layer, named board, holds all the graphics; the other layer, called actions, holds the ActionScript.  This is not necessary but is a standard way to organize an application.

The static text field is created in the usual way, using the text tool (icon A).

The radio buttons are created by clicking on the radio button icon on the component panel and dragging a button to the Stage.  The screen shot below shows the Property panel as set up for the Bush button.  In this case, the label and the data are similar.  That does not have to be the case.  Notice also the Group Name.  All four buttons would have the same group name. This works to make the Flash engine make sure that only one button is clicked.  Notice that there is no Change Handler.  This is because for this application, we wait for the 'voter' to click on the Submit Vote push button.  The Initial state and the Label Placement were left unchanged.   You need to do this for as many times as you want choices.  





Click here for  Download PDF / FREE

Using Flash, php and MySql / PDF





0

PHP script with MySQL


 PHP script with MySQL








Sample of the pdf document :









<HTML>
<head>
<title>PHP: Sample Form 1... V22.0380</title>
</head>
<body bgcolor = lightblue>

Composers on File for  <?php echo $_POST['lname']; ?>.

<?php
 /* Connecting, selecting database */
$link = mysql_connect("", "dse7916", "") or die("Could not connect : " . mysql_error());
/* echo "Connected successfully"; -- for testing purposes */
mysql_select_db("dse7916") or die("Could not select database");

/* Performing SQL query */
$query = "SELECT * FROM composers";
$result = mysql_query($query) or die("Query failed : " . mysql_error());

/* Printing results in HTML */
echo "<table>\n";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
    echo "\t\t<td>$col_value</td>\n";
      }
      echo "\t</tr>\n";
      }
      echo "</table>\n";

  /* Free resultset */
  mysql_free_result($result);

 /* Closing connection */
mysql_close($link);
 ?>

</body>
</html>


Sample #2: Using PHP to find records in the MySQL Database using selection criteria (in this case, on the field “country”)

#!/usr/local/bin/php

<HTML>
<head>
<title>PHP: Sample Form 2... V22.0380</title>
</head>
<body bgcolor = lightblue>

Composers on File for  <?php echo $_POST['lname']; ?>.

<?php
 /* Connecting, selecting database */
$link = mysql_connect("", "dse7916", "") or die("Could not connect : " . mysql_error());
/* echo "Connected successfully"; -- for testing purposes */
mysql_select_db("dse7916") or die("Could not select database");

/* Performing SQL query */
$query = "SELECT * FROM composers WHERE origin='German'";
$result = mysql_query($query) or die("Query failed : " . mysql_error());

/* Printing results in HTML */
echo "<table>\n";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
    echo "\t\t<td>$col_value</td>\n";
      }
      echo "\t</tr>\n";
      }
      echo "</table>\n";

  /* Free resultset */
  mysql_free_result($result);

 /* Closing connection */
mysql_close($link);
 ?>

</body>
</html>


Sample #3: Using a variable to determine the selection criteria in a query

#!/usr/local/bin/php

<HTML>
<head>
<title>PHP: Sample Form 3... V22.0380</title>
</head>
<body bgcolor = lightblue>

Composers on File for  <?php echo $_POST['lname']; ?>.

<?php
 /* Connecting, selecting database */
$link = mysql_connect("", "dse7916", "") or die("Could not connect : " . mysql_error());
/* echo "Connected successfully"; -- for testing purposes */
mysql_select_db("dse7916") or die("Could not select database");

/* setting a variable for the nation of origin */
$country = "Russian";

/* Performing SQL query */
$query = "SELECT * FROM composers WHERE origin='$country' ";
$result = mysql_query($query) or die("Query failed : " . mysql_error());

/* Printing results in HTML */
echo "<table>\n";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
    echo "\t\t<td>$col_value</td>\n";
      }
      echo "\t</tr>\n";
      }
      echo "</table>\n";

  /* Free resultset */
  mysql_free_result($result);

 /* Closing connection */
mysql_close($link);
 ?>

</body>
</html>





Sample #4: Allowing the user to select the country and passing the variable as a parameter to the PHP script

#!/usr/local/bin/php

<HTML>
<head>
<title>PHP: Sample Form 3... V22.0380</title>
</head>
<body bgcolor = lightblue>

<h2>Composers on File </h2>
<p>
<?php............









Click here for  Download PDF / FREE





0

PHP / MySQL Free Tutorial


PHP / MySQL Free Tutorial











Sample of the pdf document :






MySQL is currently the most popular open source database server in existence. On top of that, it is very commonly used in conjunction with PHP scripts to create powerful and dynamic server-side applications.

MySQL has been criticized in the past for not supporting all the features of other popular and more expensive DataBase Management Systems. However, MySQL continues to improve with each release (currently version 5), and it has become widely popular with individuals and businesses of many different sizes.

What is a Database?

A database is a structure that comes in two flavors: a flat database and a relational database. A relational database is much more oriented to the human mind and is often preferred over the gabble-de-gook flat database that are just stored on hard drives like a text file.

MySQL is a relational database.

In a relational structured database there are tables that store data. The columns define which kinds of information will be stored in the table. An individual column must be created for each type of data you wish to store (i.e. Age, Weight, Height). On the other hand, a row contains the actual values for these specified columns. Each row will have 1 value for each and every column. For example a table with columns (Name, Age, Weight-lbs) could have a row with the values (Bob, 65, 165). If all this relational database talk is too confusing, don't despair. We will talk about and show a few examples in the coming lessons.

Why Use a Database?

Databases are most useful when it comes to storing information that fits into logical categories. For example, say that you wanted to store information of all the employees in a company. With a database you can group different parts of your business into separate tables to help store your information logically. Example tables might be: Employees, Supervisors, and Customers. Each table would then contain columns specific to these
three areas. To help store information related to each employee, the Employees table might have the following columns: Hire, Date, Position, Age, and Salary.

Learn MySQL

Before you begin this tutorial you should have a basic knowledge of the information covered in our PHP and HTML tutorials.

This tutorial focuses heavily on using MySQL in a PHP environment. It is aimed at teaching those who have web hosts with PHP and MySQL already installed. If you are unsure, please contact your web host.

MySQL Setup Guide

The easiest way to experiment with MySQL and PHP is to purchase some space on a shared web host.

Although you can set up MySQL manually on your home PC, it can be rather difficult for a beginner to do, and would require more than a few lessons! If you think you've got what it takes, or you're just mentally unstable, head on over to MySQL.com for more information on installing MySQL yourself.

Setting Up MySQL in CPanel

There are many different types of control panels that your shared hosting provider may have. This tutorial assumes that you are using the most popular, CPanel.

First, find the link that allows you to administer MySQL. Within CPanel the icon is labeled MySQL Databases. Once there, you will need to do the following before you can start using MySQL.






 Click here for  Download PDF / FREE




PHP / MySQL Free Tutorial 

0

PHP/ MySQL Programming

PHP/ MySQL Programming










Table of Contents:







Introduction
Chapter 1 - Exploring the PHP Environment
Chapter 2 - Using Variables and Input
Chapter 3 - Controlling Your Code with Conditions and Functions
Chapter 4 - Loops and Arrays: The Poker Dice Game
Chapter 5 - Better Arrays and String Handling
Chapter 6 - Working with Files
Chapter 7 - Using MySQL to Create Databases
Chapter 8 - Connecting to Databases Within PHP
Chapter 9 - Data Normalization
Chapter 10 - Building a Three-Tiered Data Application



--------------------------------------



Sample of the pdf document :










Introduction:

If you've been watching the Web for a while you've probably noticed it is changing. When the Web first entered into the public consciousness, it was a way to distribute documents. These documents were pretty easy to make.

Anybody with a weekend and a text editor could get a Web page up and running. Building a Web site in the early days was about making documents.

Today the Internet is much more than that. Interesting Web sites are not simply documents; they are applications. They have much more complexity and power. You might think the Web is no longer a place for individuals or beginning programmers. Many of the software development tools available
are expensive and complicated.

To me, the most exciting thing about the Internet is its social implications.

There is a large community that believes in powerful, easy-to-use, free software. That community has produced a number of exceptional programs,
including PHP and MySQL.

PHP is a powerful programming language that lets you build dynamic Web ites. It works well on a variety of platforms, and it's reasonably easy to understand. MySQL is an impressive relational data management system used to build commercial quality databases. PHP and MySQL are such
powerful and easy-to-use platforms that they make Web programming accessible even for beginners.
In this book, I will teach you about programming. Specifically, you will learn how to write programs on Web servers. You'll learn all the main concepts of programming languages. You'll also learn about how data works in the modern environment. You'll learn commands and syntax, but you'll also learn the process of programming.

If you've never written a computer program before, this book will be a good introduction. If you're an experienced programmer wanting to learn PHP and MySQL, you'll find this book to be a gentle introduction.

Programming is hard work, but it's also a lot of fun. I had a great time writing this book, and I hope you enjoy learning from it. I'm looking forward to hearing about what you can do after you learn from this book.









 Click here for  Download PDF / FREE


PHP/ MySQL Programming



0

Learning PHP and MySQL / PDF

Learning PHP and MySQL / PDF












Table of Contents:






1. Dynamic Content and the Web
HTTP and the Internet 
PHP and MySQL’s Place in Web Development 
The Components of a PHP Application 
Integrating Many Sources of Information 
Requesting Data from a Web Page 

2. Installation 
Developing Locally 
Working Remotely 
3. Exploring PHP 
PHP and HTML Text 
Coding Building Blocks 

4. PHP Decision-Making 
Expressions 
Operator Concepts 
Conditionals 
Looping 

5. Functions 
Calling Functions 
Defining Functions 
Object-Oriented Programming 


6. Arrays 
Array Fundamentals 

7. Working with MySQL
MySQL Database 
Managing the Database 
Using phpMyAdmin 
Database Concepts 
Structured Query Language 

8. Database Best Practices 
Database Design 
Backing Up and Restoring Data 
Advanced SQL 

9. Getting PHP to Talk to MySQL 
The Process 
Querying the Database with PHP Functions 
Using PEAR 

10. Working with Forms 

Building a Templates 

11. Practical PHP . 
String Functions 
Date and Time Functions 
File Manipulation 
Calling System Calls

12. XHTML
Why XHTML? 
XHTML and XML Namespaces 
XHTML Versions 
Generating XHTML with PHP 

13. Modifying MySQL Objects and PHP Data 
Changing Database Objects from PHP 
Manipulating Table Data 
Displaying Results with Embedded Links 
Presenting a Form to Add and Process in One File 

Updating Data
Deleting Data 
Performing a Subquery 

14. Cookies, Sessions, and Access Control .
Cookies 
PHP and HTTP Authentication 
Sessions 
Using Auth_HTTP to Authenticate 

15. Security
Session Security 

16. Validation and Error Handling 
Validating User Input with JavaScript 
Pattern Matching 
Redisplaying a Form After PHP Validation Fails 

17. Sample Application 
Configuration File 
Page Framework 
Database
Displaying a Postings Summary 
Displaying a Posting and Its Comments 
Adding and Changing Posts
Adding and Changing Comments 

18. Finishing Your Journey 
PHP Coding Standards 
PEAR 
Frameworks 
Ajax 
Wikis 
Finding Help on the Web 
Appendix. Solutions to Chapter Questions








 Click here for  Download PDF / FREE


Learning PHP and MySQL / PDF



0

Tags