PHP: Output Formatting

Slides:



Advertisements
Similar presentations
Internet Basics & Way Beyond!
Advertisements

PHP and MySQL Database. Connecting to MySQL Note: you need to make sure that you have MySQL software properly installed on your computer before you attempt.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic PHP.
PHP and MySQL PHP for the Web, page PHP and MySQL MySQL Resource PHP – MySQL Resource
Multiple Tiers in Action
Images and Tables. Displaying Image Attributes: SRC= " mypic.gif " – Name of the picture file SRC= " pic/mygif.jpg " – Name of file found in pic directory.
Using HTML to Create Tables in Web pages Connie Lindsey November 2005.
Database Basics CS Why use a database?  powerful: can search it, filter data, combine data from multiple sources  fast: can search/filter a database.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
INTRODUCTORY Tutorial 7 Creating Tables. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Discern the difference between data tables and.
Class 1Intro to Databases Goals of this class Understand the architecture behind web database applications Gain a basic understanding of what relational.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
Technology & Management Club Development Software Overview.
HTML— More Tags, Formatting, and Lists. Formatting Tags  Bold  Italics  Underline  Big text  Small text  Subscript (H 2 O)  Superscript (10 3 )
THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week.
26 HTML Tables … surround table … surround each row … surround each cell … like, but bold and centered by default (for table headings) … table title No.
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
Class 1Intro to Databases Goals of this class Understand the architecture behind web database applications Gain a basic understanding of what relational.
HTML Help book. HTML HTML is the programming language used to make web pages for the Internet. HTML stands for Hyper Text Markup Language. HTML is made.
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
PHP AND SQL SERVER: CONNECTION IST 210: Organization of Data IST210 1.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Web Database Programming Using PHP
Tried my best to simplify it for you!
Databases.
CNIT 131 HTML5 - Tables.
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Website Development & Management
Applying CSS to Tables Stylish Tables.
Yourfriendmanoj.wordpress.com Fb/yourfriendmanoj
IS1500: Introduction to Web Development
Web Database Programming Using PHP
PHP: Inserting data FdSc Module 109 Server side scripting and
HTML Tables CS 1150 Spring 2017.
LINQ to DATABASE-2.
Lesson 7 Week 7 Course project defence Nov. 7, 2017
BASIC PHP and MYSQL Edward S. Flores.
PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting
TABLES.
HTML Tables CS 1150 Fall 2016.
Creating Tables Steps for creating a Table Important Facts about Table
Essentials of HTML.
HTML/XML HTML Authoring.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Creating Tables Steps for creating a Table Important Facts about Table
LESSON Extension Module 2: HTML Basics Tables.
In Class Programming BIS1523 – Lecture 11.
Basic Tables.
Server-Side Processing II
PHP: Database Basic Selection FdSc Module 109
PHP: Combo box FdSc Module 109 Server side scripting and
Basic Tables.
HTML Tables.
Basic Tables.
Site Development Foundations Lesson 6
PHP AND MYSQL.
Creating Tables Steps for creating a Table Important Facts about Table
Assignment help PHP + MySQL crash course
H T M L A B E S X P I N D.
This is a <SELECT> box:
CS205 Tables & Forms © 2012 D. J. Foreman.
A Title Link 1 Some text A picture Link 2 Link 3 Link 4   Link 1 | Link 2 | Link 3 | Link 4.
HTML Forms What are clients? What are servers?
Database SQL.
CS205 Tables & Forms © 2008 D. J. Foreman.
Contents: 1. More on tables 2. Images (the <img> tag)
CS205 Tables & Forms © 2004 D. J. Foreman.
Presentation transcript:

PHP: Output Formatting FdSc Module 109 Server side scripting and Database design 2011

basicSelection.php This script did not format the data very well We should use tables to display data Table tags <table> </table> <tr> </tr> a row <td> </td> a data cell We can also use print to output HTML

print print("<table width='500' border='1'>"); This command will create a table with a width of 500 pixels and a border Make this the first command in the modified basicSelection.php (after the if ($connectionSuccess == 1) { )

Be more selective Use SQL to retrieve the title and author $result = mysql_query("SELECT title, author FROM books"); while ($row = mysql_fetch_array($result)) {

Assign variables Assign the results of the query to variables $Title = $row['title']; $Author = $row['author'];

Print the results in table cells print("<tr>"); print("<td>$Title </td><td> $Author</td>"); print("</tr>");

Complete code if ($connectionSuccess == 1) { print("<table width='500' border='1'>"); $result = mysql_query("SELECT title, author FROM books"); while ($row = mysql_fetch_array($result)) { $Title = $row['title']; $Author = $row['author']; print("<tr>"); print("<td>$Title </td><td> $Author</td>"); print("</tr>"); } mysql_free_results($result); //free up server memory

Appearance