This document is the first page of a tutorial on PHP and MySQL. It introduces PHP and MySQL as a powerful combination for building database-driven websites. PHP is a server-side scripting language that can be embedded in HTML pages. MySQL is an open-source database management system that is small, compact, and ideal for many applications. The tutorial will cover installing PHP and MySQL, writing basic scripts, loading and retrieving data from a database.
This document provides a tutorial for installing PHP on Linux. It explains:
- PHP will be installed as a shared module loaded into Apache2 dynamically.
- Steps include downloading the PHP source, configuring with options like paths for Apache and MySQL, compiling, editing Apache's configuration to load PHP, creating a php.ini file, and restarting Apache.
- The tutorial was written for SuSE but should work on other Linux systems and supports PHP versions 5.0.4 through 5.2.1. It provides guidance for upgrading PHP as well.
This document provides steps to add Informix support to an existing PHP development environment using a LAMP (Linux, Apache, MySQL, PHP) stack. It describes downloading and installing XAMPP to set up the LAMP components, then downloading and installing the Informix database engine and Informix Client Software Development Kit (CSDK). Key steps include extracting the downloaded Informix packages, modifying permissions on installation files, running installation programs, verifying the PHP and database installations are working properly, and preparing to connect PHP to Informix using the CSDK libraries.
This homework assignment covers basic Unix and Perl skills. Students are instructed to:
1) Install Linux if they don't already have it and familiarize themselves with basic Unix commands through tutorials.
2) Learn important Unix text processing tools like grep, cut, sort, and pipes. Students are given example commands to run on E. coli genome data and explain what each command does.
3) Submit their responses to the tutorial questions and command explanations for grading.
Midwest php 2013 deploying php on paas- why & howdotCloud
Deploying PHP applications to Platform as a Service (PaaS) can provide several benefits over traditional hosting methods. PaaS allows developers to quickly deploy new environments for testing code changes. It also handles tasks like optimizing stacks, upgrading software, and providing comprehensive routing. PaaS aims to make deployment as simple as uploading code and eliminates the need to manually configure servers. While there is an initial learning curve to using PaaS tools and reworking some applications, it can improve the development to production workflow and allow applications to easily scale on demand.
PHP was created in 1995 by Rasmus Lerdorf to track visitors to his personal website. It has since grown tremendously in popularity and functionality. This book aims to teach PHP to both experienced and novice readers, covering all aspects of the language from basics to object-oriented programming and database integration. The intended audience includes those with web experience but no prior programming knowledge.
Study, design and development of an integration component with sensory featur...José Fidalgo
This document describes a project to develop a smart irrigation platform leveraging an existing IoT middleware. The platform supports sensors and actuators and uses complementary information from weather services. It exposes functionality through a service to enable remote access. The goal is to integrate connected objects and expose them as internet services. An IoT middleware was selected to integrate objects and a literature review analyzed reference architectures and commercial irrigation products.
The document discusses the architecture of the Internet of Things (IoT). It describes the four main layers of an IoT architecture:
1) The application layer which connects the physical and digital world through sensors.
2) The gateway and network layer which provides a robust network infrastructure to support communication requirements.
3) The management service layer which captures sensory data and performs data analytics.
4) The sensor layer which incorporates sensors to measure physical quantities and collect real-time information.
This document provides a tutorial for installing PHP on Linux. It explains:
- PHP will be installed as a shared module loaded into Apache2 dynamically.
- Steps include downloading the PHP source, configuring with options like paths for Apache and MySQL, compiling, editing Apache's configuration to load PHP, creating a php.ini file, and restarting Apache.
- The tutorial was written for SuSE but should work on other Linux systems and supports PHP versions 5.0.4 through 5.2.1. It provides guidance for upgrading PHP as well.
This document provides steps to add Informix support to an existing PHP development environment using a LAMP (Linux, Apache, MySQL, PHP) stack. It describes downloading and installing XAMPP to set up the LAMP components, then downloading and installing the Informix database engine and Informix Client Software Development Kit (CSDK). Key steps include extracting the downloaded Informix packages, modifying permissions on installation files, running installation programs, verifying the PHP and database installations are working properly, and preparing to connect PHP to Informix using the CSDK libraries.
This homework assignment covers basic Unix and Perl skills. Students are instructed to:
1) Install Linux if they don't already have it and familiarize themselves with basic Unix commands through tutorials.
2) Learn important Unix text processing tools like grep, cut, sort, and pipes. Students are given example commands to run on E. coli genome data and explain what each command does.
3) Submit their responses to the tutorial questions and command explanations for grading.
Midwest php 2013 deploying php on paas- why & howdotCloud
Deploying PHP applications to Platform as a Service (PaaS) can provide several benefits over traditional hosting methods. PaaS allows developers to quickly deploy new environments for testing code changes. It also handles tasks like optimizing stacks, upgrading software, and providing comprehensive routing. PaaS aims to make deployment as simple as uploading code and eliminates the need to manually configure servers. While there is an initial learning curve to using PaaS tools and reworking some applications, it can improve the development to production workflow and allow applications to easily scale on demand.
PHP was created in 1995 by Rasmus Lerdorf to track visitors to his personal website. It has since grown tremendously in popularity and functionality. This book aims to teach PHP to both experienced and novice readers, covering all aspects of the language from basics to object-oriented programming and database integration. The intended audience includes those with web experience but no prior programming knowledge.
Study, design and development of an integration component with sensory featur...José Fidalgo
This document describes a project to develop a smart irrigation platform leveraging an existing IoT middleware. The platform supports sensors and actuators and uses complementary information from weather services. It exposes functionality through a service to enable remote access. The goal is to integrate connected objects and expose them as internet services. An IoT middleware was selected to integrate objects and a literature review analyzed reference architectures and commercial irrigation products.
The document discusses the architecture of the Internet of Things (IoT). It describes the four main layers of an IoT architecture:
1) The application layer which connects the physical and digital world through sensors.
2) The gateway and network layer which provides a robust network infrastructure to support communication requirements.
3) The management service layer which captures sensory data and performs data analytics.
4) The sensor layer which incorporates sensors to measure physical quantities and collect real-time information.
Graeme Merrall provides a 3-part tutorial on using PHP and MySQL to create data-driven websites. In the first lesson, he covers installing PHP and MySQL on Unix and Windows systems. He demonstrates simple scripts for inserting data into a database and displaying it on a web page. The second lesson covers more advanced PHP features like loops and forms. By the end of lesson 2, readers will be able to add, edit, and remove data from their database. In lesson 3, Graeme covers validation and other techniques to make PHP scripts more robust and organized, concluding with advice for aspiring PHP/MySQL developers.
This document provides instructions for installing PHP and MySQL to create basic database-driven websites. It covers downloading and compiling MySQL from source on Unix systems, and includes instructions for installing precompiled versions on Windows. It also covers downloading and compiling PHP from source on Unix, with options for compiling as an Apache module or CGI binary. The document includes examples of simple PHP scripts to output "Hello World" and connect to a MySQL database. It aims to provide all the necessary information to get started with basic PHP/MySQL development.
This document provides an overview of the IT3101 Web-based Database Development course. The course aims to teach theoretical and practical skills for developing web-based database systems using PHP, MYSQL and SQL. The course content is divided into three parts that cover working with MySQL, working with PHP, and building simple applications. Key topics include an introduction to client-side and server-side scripting, learning PHP syntax and functions, interacting with MySQL databases, and putting the skills to use through sample projects.
Facebook uses a customized LAMP stack and additional technologies to support over 500 million users. Key aspects include:
1) Facebook created HipHop for PHP to improve PHP performance by 50%, transforming PHP to C++ binaries.
2) Facebook stores most user data in MySQL clusters but also uses Cassandra, Hadoop, and Apache Hive for large-scale data analysis across petabytes of user data.
3) Data analysis is crucial for product decisions; Facebook analyzes data from web servers and databases to test features and email content. Scribe and Hadoop are used to aggregate this data.
LAMP is a shorthand term for a web application platform consisting of Linux, Apache, MySQL and one of Perl or PHP or Python. Together, these open-source tools provide a world-class platform for deploying web applications. LAMP has been touted as "the killer app" of the open-source world.
This document provides an overview of the LAMP web development stack, including its components (Linux, Apache, MySQL, PHP), why it is a popular choice for web applications, how each component works, how to implement a LAMP-based application, and the benefits of using LAMP such as ease of use, deployment and coding. It notes that LAMP is well-suited for applications that don't require large data exchanges or complex state maintenance. The conclusion reiterates that PHP, HTML, and databases will continue to dominate web design.
This document provides an overview of the LAMP web development stack, including its components (Linux, Apache, MySQL, PHP), why it is a popular choice for building web applications, how each component works together, and the benefits it provides such as ease of use, scalability, and local development. Some key points are that LAMP allows for quick development of data-driven web applications, uses open source tools, and provides a low-cost way to deploy websites and applications.
This document summarizes a project report that built three web applications with different configurations to compare performance. Application 1 used Linux, Apache, Perl and MySQL. Application 2 used Windows, IIS, C# and SQL Server 2000. Application 3 used Windows, Tomcat, JSP/Servlets and MySQL. Simple tests found C# and JSP/Servlet had similar performance, while SQL Server 2000 outperformed MySQL. The report concluded more robust testing is needed but provided an overview of different web setups.
The document summarizes a student's final project report for their CS491A class. The project involved building three different web application systems with different technology stacks and measuring their performance. The first system used Red Hat Linux, Apache, Perl, and MySQL. The second used Windows 2000, IIS, ASP.NET, C#, and SQL Server 2000. The third used Windows, Apache, Java servlets/JSPs, and MySQL. The student found that the first system had the best performance on older hardware but was more difficult to configure, while the second system's components worked more seamlessly together but ran slower.
This document summarizes a project report that built three web applications with different configurations to compare performance. Application 1 used Linux, Apache, Perl and MySQL. Application 2 used Windows, IIS, C# and SQL Server 2000. Application 3 used Windows, Tomcat, JSP/Servlets and MySQL. Simple tests found C# and JSP/Servlet had similar performance, while SQL Server 2000 outperformed MySQL. The report concluded more robust testing is needed but provided an overview of different web setups.
The document summarizes a student project that builds three different web application systems with different technology stacks and compares their performance. The first application is built on Red Hat Linux, Apache web server, Perl programming language, and MySQL database. The second uses Windows 2000, IIS web server, ASP.NET programming with C# and SQL Server 2000 database. The third combines Windows, Apache web server, Java servlets/JSP programming and MySQL database. After building each system, the student will do a simple performance test to compare response times and provide information to help developers choose technologies.
This document provides an overview of machine learning in cyber security. It discusses definitions of machine learning, cyber security, and how machine learning can be used for cyber security tasks like malware detection. It also covers theoretical concepts, hands-on materials like necessary software and lab setup, and guidance for projects. Specific machine learning and security tools are mentioned, like Docker for containerization. The document aims to explain the importance and applications of machine learning in cyber security.
The document is a presentation about scaling applications with Symfony. It discusses concepts related to scalability like load balancing and sharding. It provides advice on profiling code to diagnose bottlenecks and optimizing aspects like caching, databases, and front-end performance. Specific technologies discussed include APC, Zend Opcache, Memcached, Redis, MySQL, and NoSQL databases. Real-world examples of large applications built with Symfony like a social game with millions of daily users are also presented.
Presention on Facebook in f Distributed systemsAhmad Yar
Facebook is a social networking website where users can post comments, share photographs and post links to news or other interesting content on the web, chat live, and watch short-form video. You can even order food on Facebook if that's what you want to do. Shared content can be made publicly accessible, or it can be shared only among a select group of friends or family, or with a single person
This document discusses the planning and initial development of an interactive wiki application called Criki using PHP and MySQL. It will cover designing the database schema and basic application scaffolding in the first part. Future parts will add functionality like wiki markup, file uploads, user permissions, calendaring/milestones, and an open blog. The goal is to build a fully-featured wiki from scratch to understand the considerations that go into such an application.
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...Yusuf Hadiwinata Sutandar
Sesi Terakhir sebelum libur PHPID-OL memasuki Bulan Puasa Ramadhan. Kita akan ketemu lagi 19 April 2021.
Topik penutup yang akan diisi oleh Om Yusuf Hadiwinata, Praktisi Teknologi terkemuka dan ternama di lingkungan Industri IT Indonesia...
Ciyaooo.... Maju Terus PHP Indonesia
Link Video: https://fb.me/e/hzWbd0FeW
Jam BW is a Java-based biologist created by Afsheen Khalid, a student at the University of Education in Okara, Pakistan. The document discusses how Java applications are platform independent and can be run on any computer. It also covers some of the software problems with third-party applications, the services provided by networked computers, how laboratory devices could be programmed with Java, and how this could lead to the creation of virtual robots.
Linux Operating System (Graduate Level CIS Term Paper)Carla Bennington
This essay compares the Disney films Beauty and the Beast and Toy Story. Both films use animation to bring their stories to life, though Beauty and the Beast uses traditional hand-drawn animation while Toy Story utilizes computer-generated imagery. The essay discusses the plots, characters, and themes of the two films, highlighting similarities and differences between the classic tale of Beauty and the Beast and the pioneering work of Pixar Animation Studios with Toy Story.
This document provides a help and tutorial for TopStyle Pro version 3.11. It covers getting started with TopStyle, editing style sheets and HTML/XHTML, working with colors, previews, validation, site management, reports, mappings, customization, and third-party integration. It also includes appendices on CSS basics and tips, TopStyle tips and tricks, style sheet resources, keyboard shortcuts, and regular expressions.
TopStyle Help & <b>Tutorial</b>tutorialsruby
This document provides a table of contents for the TopStyle Pro Help & Tutorial, which teaches how to use the TopStyle software for editing style sheets and HTML/XHTML documents. It lists over 50 sections that provide explanations and instructions for features like creating and opening files, editing styles, working with colors, previews, validation, site management, reports and customizing the software. The document was created by Giampaolo Bellavite from the online help provided with TopStyle version 3.11.
Graeme Merrall provides a 3-part tutorial on using PHP and MySQL to create data-driven websites. In the first lesson, he covers installing PHP and MySQL on Unix and Windows systems. He demonstrates simple scripts for inserting data into a database and displaying it on a web page. The second lesson covers more advanced PHP features like loops and forms. By the end of lesson 2, readers will be able to add, edit, and remove data from their database. In lesson 3, Graeme covers validation and other techniques to make PHP scripts more robust and organized, concluding with advice for aspiring PHP/MySQL developers.
This document provides instructions for installing PHP and MySQL to create basic database-driven websites. It covers downloading and compiling MySQL from source on Unix systems, and includes instructions for installing precompiled versions on Windows. It also covers downloading and compiling PHP from source on Unix, with options for compiling as an Apache module or CGI binary. The document includes examples of simple PHP scripts to output "Hello World" and connect to a MySQL database. It aims to provide all the necessary information to get started with basic PHP/MySQL development.
This document provides an overview of the IT3101 Web-based Database Development course. The course aims to teach theoretical and practical skills for developing web-based database systems using PHP, MYSQL and SQL. The course content is divided into three parts that cover working with MySQL, working with PHP, and building simple applications. Key topics include an introduction to client-side and server-side scripting, learning PHP syntax and functions, interacting with MySQL databases, and putting the skills to use through sample projects.
Facebook uses a customized LAMP stack and additional technologies to support over 500 million users. Key aspects include:
1) Facebook created HipHop for PHP to improve PHP performance by 50%, transforming PHP to C++ binaries.
2) Facebook stores most user data in MySQL clusters but also uses Cassandra, Hadoop, and Apache Hive for large-scale data analysis across petabytes of user data.
3) Data analysis is crucial for product decisions; Facebook analyzes data from web servers and databases to test features and email content. Scribe and Hadoop are used to aggregate this data.
LAMP is a shorthand term for a web application platform consisting of Linux, Apache, MySQL and one of Perl or PHP or Python. Together, these open-source tools provide a world-class platform for deploying web applications. LAMP has been touted as "the killer app" of the open-source world.
This document provides an overview of the LAMP web development stack, including its components (Linux, Apache, MySQL, PHP), why it is a popular choice for web applications, how each component works, how to implement a LAMP-based application, and the benefits of using LAMP such as ease of use, deployment and coding. It notes that LAMP is well-suited for applications that don't require large data exchanges or complex state maintenance. The conclusion reiterates that PHP, HTML, and databases will continue to dominate web design.
This document provides an overview of the LAMP web development stack, including its components (Linux, Apache, MySQL, PHP), why it is a popular choice for building web applications, how each component works together, and the benefits it provides such as ease of use, scalability, and local development. Some key points are that LAMP allows for quick development of data-driven web applications, uses open source tools, and provides a low-cost way to deploy websites and applications.
This document summarizes a project report that built three web applications with different configurations to compare performance. Application 1 used Linux, Apache, Perl and MySQL. Application 2 used Windows, IIS, C# and SQL Server 2000. Application 3 used Windows, Tomcat, JSP/Servlets and MySQL. Simple tests found C# and JSP/Servlet had similar performance, while SQL Server 2000 outperformed MySQL. The report concluded more robust testing is needed but provided an overview of different web setups.
The document summarizes a student's final project report for their CS491A class. The project involved building three different web application systems with different technology stacks and measuring their performance. The first system used Red Hat Linux, Apache, Perl, and MySQL. The second used Windows 2000, IIS, ASP.NET, C#, and SQL Server 2000. The third used Windows, Apache, Java servlets/JSPs, and MySQL. The student found that the first system had the best performance on older hardware but was more difficult to configure, while the second system's components worked more seamlessly together but ran slower.
This document summarizes a project report that built three web applications with different configurations to compare performance. Application 1 used Linux, Apache, Perl and MySQL. Application 2 used Windows, IIS, C# and SQL Server 2000. Application 3 used Windows, Tomcat, JSP/Servlets and MySQL. Simple tests found C# and JSP/Servlet had similar performance, while SQL Server 2000 outperformed MySQL. The report concluded more robust testing is needed but provided an overview of different web setups.
The document summarizes a student project that builds three different web application systems with different technology stacks and compares their performance. The first application is built on Red Hat Linux, Apache web server, Perl programming language, and MySQL database. The second uses Windows 2000, IIS web server, ASP.NET programming with C# and SQL Server 2000 database. The third combines Windows, Apache web server, Java servlets/JSP programming and MySQL database. After building each system, the student will do a simple performance test to compare response times and provide information to help developers choose technologies.
This document provides an overview of machine learning in cyber security. It discusses definitions of machine learning, cyber security, and how machine learning can be used for cyber security tasks like malware detection. It also covers theoretical concepts, hands-on materials like necessary software and lab setup, and guidance for projects. Specific machine learning and security tools are mentioned, like Docker for containerization. The document aims to explain the importance and applications of machine learning in cyber security.
The document is a presentation about scaling applications with Symfony. It discusses concepts related to scalability like load balancing and sharding. It provides advice on profiling code to diagnose bottlenecks and optimizing aspects like caching, databases, and front-end performance. Specific technologies discussed include APC, Zend Opcache, Memcached, Redis, MySQL, and NoSQL databases. Real-world examples of large applications built with Symfony like a social game with millions of daily users are also presented.
Presention on Facebook in f Distributed systemsAhmad Yar
Facebook is a social networking website where users can post comments, share photographs and post links to news or other interesting content on the web, chat live, and watch short-form video. You can even order food on Facebook if that's what you want to do. Shared content can be made publicly accessible, or it can be shared only among a select group of friends or family, or with a single person
This document discusses the planning and initial development of an interactive wiki application called Criki using PHP and MySQL. It will cover designing the database schema and basic application scaffolding in the first part. Future parts will add functionality like wiki markup, file uploads, user permissions, calendaring/milestones, and an open blog. The goal is to build a fully-featured wiki from scratch to understand the considerations that go into such an application.
PHPIDOL#80: Kubernetes 101 for PHP Developer. Yusuf Hadiwinata - VP Operation...Yusuf Hadiwinata Sutandar
Sesi Terakhir sebelum libur PHPID-OL memasuki Bulan Puasa Ramadhan. Kita akan ketemu lagi 19 April 2021.
Topik penutup yang akan diisi oleh Om Yusuf Hadiwinata, Praktisi Teknologi terkemuka dan ternama di lingkungan Industri IT Indonesia...
Ciyaooo.... Maju Terus PHP Indonesia
Link Video: https://fb.me/e/hzWbd0FeW
Jam BW is a Java-based biologist created by Afsheen Khalid, a student at the University of Education in Okara, Pakistan. The document discusses how Java applications are platform independent and can be run on any computer. It also covers some of the software problems with third-party applications, the services provided by networked computers, how laboratory devices could be programmed with Java, and how this could lead to the creation of virtual robots.
Linux Operating System (Graduate Level CIS Term Paper)Carla Bennington
This essay compares the Disney films Beauty and the Beast and Toy Story. Both films use animation to bring their stories to life, though Beauty and the Beast uses traditional hand-drawn animation while Toy Story utilizes computer-generated imagery. The essay discusses the plots, characters, and themes of the two films, highlighting similarities and differences between the classic tale of Beauty and the Beast and the pioneering work of Pixar Animation Studios with Toy Story.
This document provides a help and tutorial for TopStyle Pro version 3.11. It covers getting started with TopStyle, editing style sheets and HTML/XHTML, working with colors, previews, validation, site management, reports, mappings, customization, and third-party integration. It also includes appendices on CSS basics and tips, TopStyle tips and tricks, style sheet resources, keyboard shortcuts, and regular expressions.
TopStyle Help & <b>Tutorial</b>tutorialsruby
This document provides a table of contents for the TopStyle Pro Help & Tutorial, which teaches how to use the TopStyle software for editing style sheets and HTML/XHTML documents. It lists over 50 sections that provide explanations and instructions for features like creating and opening files, editing styles, working with colors, previews, validation, site management, reports and customizing the software. The document was created by Giampaolo Bellavite from the online help provided with TopStyle version 3.11.
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting <b>...</b>tutorialsruby
This document provides the course outline for IMD 210 Fundamentals of Scripting Languages at The Art Institute of Atlanta during the Spring 2005 quarter. The course focuses on integrating programming concepts with interface design using scripting languages like JavaScript and CSS. It will cover topics like DOM, CSS layout, JavaScript variables, conditionals, and events. Students will complete 4 assignments including redesigning existing websites, and there will be weekly quizzes, a midterm, and final exam. The course is worth 4 credits and meets once a week for class and lab.
This document provides the course outline for IMD 210 Fundamentals of Scripting Languages at The Art Institute of Atlanta during the Spring 2005 quarter. The course focuses on integrating programming concepts with interface design using scripting languages like JavaScript and CSS. It will cover topics like DOM, CSS layout, JavaScript variables, conditionals, and events. Students will complete 4 assignments including redesigning existing websites, and there will be weekly quizzes, a midterm, and final exam. The course is worth 4 credits and meets once a week for class and lab.
The group aims to bridge gaps between peer-to-peer database architectures and scaling multimedia information retrieval. They develop a probabilistic multimedia database system with abstraction layers for applications and researchers. They also research challenges of peer-to-peer networks for distributed data management. Both lines are supported by the MonetDB platform to exploit custom hardware and adaptive query optimization. The goal is a modular solution linking theoretical optimal solutions to application demands under resource limitations.
Standardization and Knowledge Transfer – INS0tutorialsruby
The group aims to bridge gaps between peer-to-peer database architectures and scaling multimedia information retrieval. They develop a probabilistic multimedia database system with abstraction layers and a flexible model. They also research challenges of peer-to-peer networks for distributed data management. Both lines are supported by the MonetDB platform to exploit custom hardware and adaptive query optimization. The goal is a modular solution linking theoretical optimal solutions to application demands under resource limitations.
This document provides an introduction to converting HTML documents to XHTML, including the basic syntax changes needed like making all tags lowercase and closing all tags. It provides examples of correct XHTML markup for different tags. It also explains the new DOCTYPE declaration and shows a sample well-formed XHTML document incorporating all the discussed changes. Resources for learning more about XHTML are listed at the end.
This document provides an introduction to converting HTML documents to XHTML, including the basic syntax changes needed like making all tags lowercase and closing all tags. It provides examples of correct XHTML markup for different tags. It also explains the new DOCTYPE declaration and shows a sample well-formed XHTML document incorporating all the discussed changes. Resources for learning more about XHTML are listed at the end.
XHTML is a markup language that provides structure and semantics to web pages. It is based on XML and is more strict than HTML. XHTML pages must have a document type definition, html and head tags, and a body where the visible content goes. Common XHTML tags include paragraphs, lists, links, images, and divisions to logically separate content. While XHTML provides structure, CSS is used to style pages and control visual presentation by defining rules for tags. CSS rules are defined in external style sheets to keep presentation separate from structure and content.
XHTML is a markup language that provides structure and semantics to web pages. It is based on XML and is more strict than HTML. XHTML pages must have a document type definition, html and head tags, and a body where the visible content goes. Common XHTML tags include paragraphs, lists, links, images, and divisions to logically separate content. While XHTML provides structure, CSS is used to style pages and control visual presentation through rules that target specific XHTML elements.
This document discusses how to create and use external cascading style sheets (CSS) in Dreamweaver. It provides steps to:
1. Open the CSS Styles tab in Dreamweaver and create a new external CSS stylesheet using a sample text style.
2. Save the stylesheet and link it to a new HTML page to style elements like headings, text sizes, and boxes.
3. Edit existing styles by selecting a tag in the CSS Styles panel and modifying properties directly, or by clicking the tag and using the pencil icon to edit in a window. This allows customizing styles globally across all linked pages.
This document provides an overview of how to create and use cascading style sheets (CSS) in Dreamweaver. It describes the different types of style sheets, including external and internal style sheets. It outlines the steps to create an external style sheet in Dreamweaver using the CSS Styles panel and provides instructions for linking the external style sheet to an HTML page. The document demonstrates how to experiment with predefined styles and how to edit, add, and delete styles in the CSS stylesheet.
This document appears to be a weekly update from an intro to computer science course. It includes summaries of classmates' demographics, comfort levels, and prior experience. It also discusses time spent on problem sets and recommends upcoming courses in CS51 and CS61. Finally, it recommends reading on TCP/IP, HTTP, XHTML, CSS, PHP, SQL and using the bulletin board for questions.
This document appears to be a weekly update from an intro to computer science course. It includes summaries of classmates' demographics, comfort levels, and prior experience. It also discusses time spent on problem sets and recommends upcoming courses in CS51 and CS61. Finally, it recommends reading on topics like TCP/IP, HTTP, XHTML, CSS, PHP, SQL and using bulletin boards, and includes images related to these topics.
The document discusses how to use Cascading Style Sheets (CSS) with Corvid Servlet Runtime templates to control formatting and layout. CSS allows separating design from content, making templates simpler and easier to maintain. It also enables adapting appearance for different devices. The document provides examples of using CSS classes to style template elements and explains how to set up a demo system using the included CSS and templates.
The document discusses how to use Cascading Style Sheets (CSS) with Corvid Servlet Runtime templates to control formatting and layout. CSS allows separating design from content, making templates simpler and easier to maintain. It also enables customization of appearance for different devices. The document provides examples of how to apply CSS classes and rules to Corvid template elements to control fonts, colors, positioning and more.
The document provides an introduction to CSS and how it works with HTML to control the presentation and styling of web page content. It explains basic CSS concepts like selectors, properties and values, and how CSS rules are used to target specific HTML elements and style them. Examples are given of common CSS properties and selectors and how they can be used to style elements and format the layout of web pages.
The document introduces CSS and how it works with HTML to separate content from presentation, allowing the styling of web pages through rules that target HTML elements. It explains CSS syntax and various selectors like type, class, ID, and descendant selectors. Examples are provided of how CSS can be used to style properties like color, font, padding, and layout of elements on a page.
Cascading Style Sheets (CSS) allow users to define how HTML elements are presented on a page. CSS enables changing the appearance and layout of an entire website by editing just one CSS file. CSS uses selectors to apply styles to HTML elements via properties and values. Styles can be defined internally in HTML or externally in CSS files. CSS can control text formatting, colors, spacing, positioning and more to achieve visual consistency across web pages.
Cascading Style Sheets (CSS) allow users to define how HTML elements are presented on a page. CSS enables changing the appearance and layout of an entire website by editing just one CSS file. CSS uses selectors to apply styles to HTML elements via properties and values. Styles can be defined internally in HTML or externally in CSS files. CSS can control text formatting, colors, spacing, positioning and more to achieve visual consistency across web pages.
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...DanBrown980551
This LF Energy webinar took place June 20, 2024. It featured:
-Alex Thornton, LF Energy
-Hallie Cramer, Google
-Daniel Roesler, UtilityAPI
-Henry Richardson, WattTime
In response to the urgency and scale required to effectively address climate change, open source solutions offer significant potential for driving innovation and progress. Currently, there is a growing demand for standardization and interoperability in energy data and modeling. Open source standards and specifications within the energy sector can also alleviate challenges associated with data fragmentation, transparency, and accessibility. At the same time, it is crucial to consider privacy and security concerns throughout the development of open source platforms.
This webinar will delve into the motivations behind establishing LF Energy’s Carbon Data Specification Consortium. It will provide an overview of the draft specifications and the ongoing progress made by the respective working groups.
Three primary specifications will be discussed:
-Discovery and client registration, emphasizing transparent processes and secure and private access
-Customer data, centering around customer tariffs, bills, energy usage, and full consumption disclosure
-Power systems data, focusing on grid data, inclusive of transmission and distribution networks, generation, intergrid power flows, and market settlement data
"What does it really mean for your system to be available, or how to define w...Fwdays
We will talk about system monitoring from a few different angles. We will start by covering the basics, then discuss SLOs, how to define them, and why understanding the business well is crucial for success in this exercise.
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...Fwdays
Direct losses from downtime in 1 minute = $5-$10 thousand dollars. Reputation is priceless.
As part of the talk, we will consider the architectural strategies necessary for the development of highly loaded fintech solutions. We will focus on using queues and streaming to efficiently work and manage large amounts of data in real-time and to minimize latency.
We will focus special attention on the architectural patterns used in the design of the fintech system, microservices and event-driven architecture, which ensure scalability, fault tolerance, and consistency of the entire system.
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfleebarnesutopia
So… you want to become a Test Automation Engineer (or hire and develop one)? While there’s quite a bit of information available about important technical and tool skills to master, there’s not enough discussion around the path to becoming an effective Test Automation Engineer that knows how to add VALUE. In my experience this had led to a proliferation of engineers who are proficient with tools and building frameworks but have skill and knowledge gaps, especially in software testing, that reduce the value they deliver with test automation.
In this talk, Lee will share his lessons learned from over 30 years of working with, and mentoring, hundreds of Test Automation Engineers. Whether you’re looking to get started in test automation or just want to improve your trade, this talk will give you a solid foundation and roadmap for ensuring your test automation efforts continuously add value. This talk is equally valuable for both aspiring Test Automation Engineers and those managing them! All attendees will take away a set of key foundational knowledge and a high-level learning path for leveling up test automation skills and ensuring they add value to their organizations.
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillLizaNolte
HERE IS YOUR WEBINAR CONTENT! 'Mastering Customer Journey Management with Dr. Graham Hill'. We hope you find the webinar recording both insightful and enjoyable.
In this webinar, we explored essential aspects of Customer Journey Management and personalization. Here’s a summary of the key insights and topics discussed:
Key Takeaways:
Understanding the Customer Journey: Dr. Hill emphasized the importance of mapping and understanding the complete customer journey to identify touchpoints and opportunities for improvement.
Personalization Strategies: We discussed how to leverage data and insights to create personalized experiences that resonate with customers.
Technology Integration: Insights were shared on how inQuba’s advanced technology can streamline customer interactions and drive operational efficiency.
"Choosing proper type of scaling", Olena SyrotaFwdays
Imagine an IoT processing system that is already quite mature and production-ready and for which client coverage is growing and scaling and performance aspects are life and death questions. The system has Redis, MongoDB, and stream processing based on ksqldb. In this talk, firstly, we will analyze scaling approaches and then select the proper ones for our system.
Conversational agents, or chatbots, are increasingly used to access all sorts of services using natural language. While open-domain chatbots - like ChatGPT - can converse on any topic, task-oriented chatbots - the focus of this paper - are designed for specific tasks, like booking a flight, obtaining customer support, or setting an appointment. Like any other software, task-oriented chatbots need to be properly tested, usually by defining and executing test scenarios (i.e., sequences of user-chatbot interactions). However, there is currently a lack of methods to quantify the completeness and strength of such test scenarios, which can lead to low-quality tests, and hence to buggy chatbots.
To fill this gap, we propose adapting mutation testing (MuT) for task-oriented chatbots. To this end, we introduce a set of mutation operators that emulate faults in chatbot designs, an architecture that enables MuT on chatbots built using heterogeneous technologies, and a practical realisation as an Eclipse plugin. Moreover, we evaluate the applicability, effectiveness and efficiency of our approach on open-source chatbots, with promising results.
The Department of Veteran Affairs (VA) invited Taylor Paschal, Knowledge & Information Management Consultant at Enterprise Knowledge, to speak at a Knowledge Management Lunch and Learn hosted on June 12, 2024. All Office of Administration staff were invited to attend and received professional development credit for participating in the voluntary event.
The objectives of the Lunch and Learn presentation were to:
- Review what KM ‘is’ and ‘isn’t’
- Understand the value of KM and the benefits of engaging
- Define and reflect on your “what’s in it for me?”
- Share actionable ways you can participate in Knowledge - - Capture & Transfer
AppSec PNW: Android and iOS Application Security with MobSFAjin Abraham
Mobile Security Framework - MobSF is a free and open source automated mobile application security testing environment designed to help security engineers, researchers, developers, and penetration testers to identify security vulnerabilities, malicious behaviours and privacy concerns in mobile applications using static and dynamic analysis. It supports all the popular mobile application binaries and source code formats built for Android and iOS devices. In addition to automated security assessment, it also offers an interactive testing environment to build and execute scenario based test/fuzz cases against the application.
This talk covers:
Using MobSF for static analysis of mobile applications.
Interactive dynamic security assessment of Android and iOS applications.
Solving Mobile app CTF challenges.
Reverse engineering and runtime analysis of Mobile malware.
How to shift left and integrate MobSF/mobsfscan SAST and DAST in your build pipeline.
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsScyllaDB
ScyllaDB monitoring provides a lot of useful information. But sometimes it’s not easy to find the root of the problem if something is wrong or even estimate the remaining capacity by the load on the cluster. This talk shares our team's practical tips on: 1) How to find the root of the problem by metrics if ScyllaDB is slow 2) How to interpret the load and plan capacity for the future 3) Compaction strategies and how to choose the right one 4) Important metrics which aren’t available in the default monitoring setup.
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Keywords: AI, Containeres, Kubernetes, Cloud Native
Event Link: https://meine.doag.org/events/cloudland/2024/agenda/#agendaId.4211
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
"NATO Hackathon Winner: AI-Powered Drug Search", Taras KlobaFwdays
This is a session that details how PostgreSQL's features and Azure AI Services can be effectively used to significantly enhance the search functionality in any application.
In this session, we'll share insights on how we used PostgreSQL to facilitate precise searches across multiple fields in our mobile application. The techniques include using LIKE and ILIKE operators and integrating a trigram-based search to handle potential misspellings, thereby increasing the search accuracy.
We'll also discuss how the azure_ai extension on PostgreSQL databases in Azure and Azure AI Services were utilized to create vectors from user input, a feature beneficial when users wish to find specific items based on text prompts. While our application's case study involves a drug search, the techniques and principles shared in this session can be adapted to improve search functionality in a wide range of applications. Join us to learn how PostgreSQL and Azure AI can be harnessed to enhance your application's search capability.
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Ukraine
Під час доповіді відповімо на питання, навіщо потрібно підвищувати продуктивність аплікації і які є найефективніші способи для цього. А також поговоримо про те, що таке кеш, які його види бувають та, основне — як знайти performance bottleneck?
Відео та деталі заходу: https://bit.ly/45tILxj
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
php_mysql_tutorial
1. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 1 — Introducing PHP and MySQL
•Overview
•Lesson 1 Unless you've been living on Mars for the last six to eight months,
1 Introducing PHP and you've heard of open source software (OSS). This movement has got
MySQL so much momentum that even the big boys are taking notice.
2 Installing MySQL Companies like Oracle, Informix, and a host of others are releasing
3 Installing PHP their flagship database products for that poster child of the OSS
4 Your First Script movement, Linux.
5 Load Up a Database
6 Pull It Back Out Having a massively complex RDBMS (relational database management
system) is all well and good if you know what to do with it. But
•Lesson 2 perhaps you are just getting into the world of databases. You've read
Jay's article and you want to put up your own data-driven Web site.
•Lesson 3
But you find you don't have the resources or desire for an ASP server
or some pricey database. You want something free, and you want it to
work with Unix.
Enter PHP and MySQL. These two make up what must be the best
combination for data-driven Web sites on the planet. You needn't take
my word for it. An unofficial Netcraft survey shows that PHP usage has
jumped from 7,500 hosts in June 1998 to 410,000 in March 1999.
That's not bad. The combination was also awarded Database of the
Year at Webcon98, where it received a lovely tiara.
MySQL is a small, compact database server ideal for small - and not
so small - applications. In addition to supporting standard SQL (ANSI),
it compiles on a number of platforms and has multithreading abilities
on Unix servers, which make for great performance. For non-Unix
people, MySQL can be run as a service on Windows NT and as a
normal process in Windows 95/98 machines.
PHP is a server-side scripting language. If you've seen ASP, you'll be
familiar with embedding code within an HTML page. Like ASP, PHP
script is processed by the Web server. After the server plays with the
PHP code, it returns plain old HTML back to the browser. This kind of
interaction allows for some pretty complex operations.
In addition to being free (MySQL does have some licensing restrictions
though), the PHP-MySQL combination is also cross-platform, which
means you can develop in Windows and serve on a Unix platform.
Also, PHP can be run as an external CGI process, a stand-alone script
interpreter, or an embedded Apache module.
If you're interested, PHP also supports a massive number of
databases, including Informix, Oracle, Sybase, Solid, and PostgreSQL -
as well as the ubiquitous ODBC.
PHP supports a host of other features right at the technological edge
of Internet development. These include authentication, XML, dynamic
image creation, WDDX, shared memory support, and dynamic PDF
document creation to name but a few. If that's not enough, PHP is
3. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 2 — Installing MySQL
•Overview
•Lesson 1 Let's jump straight in, grab ourselves a copy of these great packages,
1 Introducing PHP and and get hacking! This isn't simple stuff. There are lots of options
MySQL available to you for obtaining, compiling, and installing the software.
2 Installing MySQL Let's deal with MySQL first, as we'll need it before we get PHP going.
3 Installing PHP
4 Your First Script MySQL central is http://www.mysql.com/. As befits a program of its
5 Load Up a Database stature, there are a zillion mirrors located all over the globe, so do the
6 Pull It Back Out Internet a favor and pick the one closest to you.
•Lesson 2
You've got plenty of choices at this point. If you're a do-it-yourselfer,
•Lesson 3 then grab the source code. If you're not that brave, there are some
precompiled binaries for other platforms already available for
download.
In addition, there is a shareware version of MySQL for Windows users.
It is an older version of MySQL. If you want the latest version, you'll
have to purchase a license. There are also ODBC drivers that let your
applications talk to MySQL. Various other exciting bits and pieces are
lurking about on the site, too, so take a look.
The precompiled Unix versions and the Windows version are as simple
as unpacking and going, and they don't require much explanation. So
let's compile from the source code. Windows users, please keep in
mind that you need to run mysqld in the mysql/bin directory.
Download the compressed file into your source directory and
uncompress and untar it using gzip and tar. The fast way of doing this
is to type:
gunzip < mysql-xxxx.tar.gz | tar xvf -
The xxxx is where you put the version number. This will create a
directory called mysql-xxxx, which contains all the source files. Move
to that directory by typing cd mysql-xxxx and check out the various
README and INSTALL files. They're lifesavers in sticky situations.
MySQL comes with a handy configuration script. Simply type
./configure and let things take care of themselves. If you need to
specify what happens and where, typing ./configure --help gives
you a list of options to choose from. For example, if you're compiling
on a machine with little memory, you can opt for the --with-low-
memory flag. I like MySQL to install in one handy directory tree rather
then in various locations on my machine, so I specify an install
location with the --prefix flag.
You can also specify lots of other options, such as what to compile and
what to skip. Let's assume that we want everything under
/usr/local/mysql on our server. This means we'd type ./configure
5. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 3 — Installing PHP
•Overview
•Lesson 1 Phew! Hopefully you've got MySQL all up and running by now. That
1 Introducing PHP and was almost fun! Now for PHP ... This process is slightly easier, but the
MySQL array of options is dazzling. Don't be daunted, though. You can always
2 Installing MySQL go back later and recompile PHP to add or remove options as needed.
3 Installing PHP
4 Your First Script The home of PHP is http://www.php.net/. The PHP site is a mine of
5 Load Up a Database information, from project listings to bug reports. As with MySQL, you
6 Pull It Back Out should choose a nearby mirror. Obviously you'll want the Downloads
section to get PHP. I'll be taking you through an installation of PHP3.
•Lesson 2 To learn how to tackle PHP4, read Webmonkey Julie's detailed PHP4
installation instructions.
•Lesson 3
Your range of options here is a little more limited. A few precompiled
binaries are available, but these are experimental. If you're on
anything except a Windows platform, grab the source code and
compile it yourself.
But first let's cover Windows. When using PHP, a common practice is
to develop on a Windows machine and then run your site on a Unix
server. It may end up that you will do this yourself, which means you
need to be proficient in installing on both platforms.
Let's grab the Windows binary and uncompress it using our favorite
Zip decompression tool into a directory on your C drive called php3.
The supplied README file deals with the installation in some detail,
but here's the Reader's Digest version: If you want to install PHP to a
folder other than C:php3, you'll need to edit the .inf file that comes
with PHP.
In the php3 directory, you'll find a lot of .dll files. Take all the .dll files
that don't begin with php_ and move them into your windowssystem
directory. Then rename php.ini-dist to php3.ini and move it into your
windows directory. If you open up that file, you'll see there are lots of
interesting things to change. For now just "uncomment" the line:
extension=php3_mysql.dll
If you're using Apache for Win32, set up Apache to recognize and
parse PHP files. Depending on the version of Apache you're using,
you'll need to add the following to either the httpd.conf or srm.conf
file:
ScriptAlias /php3/"c:/path-to-php-dir/"
AddType application/x-httpd-php3 .php3
Action application/x-httpd-php3"/php3/php.exe"
Or if you're using IIS or PWS, right-click on php_iis_reg.inf and
select 'Install'. You'll need to reboot for IIS to see this change.
7. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 4 — Your First Script
•Overview
•Lesson 1 You'll be glad to know that the really tricky stuff is behind you.
1 Introducing PHP and Installation of software is always a black hole because so much
MySQL changes from system to system. But with any luck your database is up
2 Installing MySQL and running, and PHP is compiled and installed with our Web server
3 Installing PHP and able to recognize documents with .php3 extensions.
4 Your First Script
5 Load Up a Database Let's dive right in and write our first script. Create a text file
6 Pull It Back Out containing the following:
•Lesson 2
<html>
•Lesson 3
<body>
<?php
$myvar = "Hello World";
echo $myvar;
?>
</body>
</html>
Now call up the URL, for instance, http://myserver/test.php3. You
should see a page containing the text "Hello World." If you get an
error message, check the PHP documentation to see if you set things
up properly.
That's it! That's your first PHP script. If you view the HTML source for
the page, you'll see that there is only the text. Hello World
That's because the PHP engine has examined the page, processed any
code blocks that it found, and returned only HTML.
The first thing you'll notice about the script above are the delimiters.
These are the lines that start <?php. This indicates the start of a block
of PHP code, and ?> indicates the end of the block. The power of PHP
is that these can be placed anywhere - and I mean anywhere - in your
code in any number of ways. Later we'll see some interesting uses for
these, but for now let's keep it simple. If you wish, you can also
configure PHP to use short tags, <?, and ?>, but these are not XML
compliant, so be careful. If you're making the switch from ASP, you
can even configure PHP to use the <% and %> delimiters.
9. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 5 — Load Up a Database
•Overview
So now we're ready to plug in MySQL. One handy way of knowing what
•Lesson 1 options are available in PHP and what's going on in your server is to
1 Introducing PHP and use the phpinfo() function. Create a script with the following:
MySQL
2 Installing MySQL
3 Installing PHP <html>
4 Your First Script
<body>
5 Load Up a Database
6 Pull It Back Out
•Lesson 2 <?php
•Lesson 3 phpinfo();
?>
</body>
</html>
10. Save and view this script through your Web server. You'll see a page
filled with useful and interesting information like this. This info tells all
about your server, internal Web server environment variables, the
options that are compiled, and on and on. In the first section,
Extensions, look for a line beginning with MySQL. If this is missing,
then for some reason MySQL hasn't made it into PHP. Go back and
review the installation steps and check the PHP documentation to see if
you missed anything.
If MySQL is there, then you're ready to roll.
Before we can get data out of MySQL, we have to put data in it.
There's really no easy way to do it at this stage. Most PHP scripts come
with what's known as a dump file that contains all the data required to
create and populate a MySQL database. The ins and outs of this
process are really outside the scope of this tutorial, so I'll just do it for
you.
MySQL uses its own user permissions table. At setup, a default user
(root) is automatically created with no password. It's up to the
database administrator to add other users with various permissions,
but I could write a whole other article on that, so we'll stick with using
the root user. If you set up your own server and database, it's vital
that you assign a password to the root user.
Anyway, let's get on with the database. For Win32 users, I'm sorry,
but this requires some DOS work. You'll have to use a DOS window or
type everything in the Run window. Don't forget to type in the path to
the location of the MySQL/bin directory with your commands. Unix
users can work from the MySQL bin directory, but you may have to
start each command with ./ so the programs run.
The first thing we need to do is create the actual database. From the
command line, type:
mysqladmin -u root create mydb
That creates a database called "mydb." The flag tells MySQL that we're
doing this as the root user.
12. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 6 — Pull It Back Out
•Overview
•Lesson 1 OK, now we've got our data in the database. Let's do something with it.
1 Introducing PHP and Copy and paste the following into a text file and save it in your Web server
MySQL document tree with a .php3 extension.
2 Installing MySQL
3 Installing PHP
4 Your First Script
5 Load Up a Database
<html>
6 Pull It Back Out
•Lesson 2
<body>
•Lesson 3
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>n", mysql_result($result,0,"last"));
printf("Address: %s<br>n", mysql_result($result,0,"address"));
printf("Position: %s<br>n", mysql_result($result,0,"position"));
?>
</body>
</html>
14. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 2
by Graeme Merrall
this article for free.
-------------------------
Page 1 — Getting Loopy
•Overview
•Lesson 1 In this lesson, we're going to dive right in and create some simple yet useful pages using PHP and
MySQL. Let's start by displaying the database we created yesterday, but with a little more panache.
•Lesson 2
1 Getting Loopy
2 Stay Informed
First, let's query our database using the following code.
3 Link Intelligently
4 Throw in Some Forms
5 Make the Forms Smarter
6 All Together Now <html>
•Lesson 3
<body>
<?php
16. ?>
</body>
</html>
You probably noticed that we introduced a couple of new features here. Most obvious is the while()
loop. The loop says that as long as there are new rows of data to be grabbed (using the
mysql_fetch_row() function), assign that row to the $myrow variable. Then execute the instructions
between the curly brackets ({}). Take a look for a second, and this should make sense.
The mysql_fetch_row() function bears a closer look. One small problem with mysql_fetch_row() is
that it returns an array that supports only numeric references to the individual fields. So the first field is
referred to as 0, the second as 1, and so on. With complex queries this can become something of a
nightmare.
Now let's examine the loop in more detail. The first few lines you'll recognize from the example in
Lesson 1. Then in the while() loop we fetch a row from the result and assign it to the array $myrow.
Then we print the contents of the array on the screen with the printf function. After that it loops
around again, and another row is assigned to $myrow. It will do this until it runs out of rows to grab.
The great thing about a while() loop is that if your query returns no records, you won't get an error
message. The first time through there won't be any data to assign to $myrow, and the program will just
move on.
But if the query returns no data, we have no way of letting the user know, and we should probably
18. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 3
by Graeme Merrall
this article for free.
-------------------------
Page 1 — A Place for Everything
•Overview
Welcome to the third and final lesson for this tutorial. If you've gone
•Lesson 1 through Lesson 1 and Lesson 2, you already know the essentials for
installing and writing useful scripts with MySQL and PHP. We're going
•Lesson 2 to look at some useful PHP functions that should make your life a lot
easier. First, let's look at include files.
•Lesson 3
1 A Place for Everything
2 Simple Validation We all know the basics of includes, right? Contents of an external file
are referenced and imported into the main file. It's pretty easy: You
3 Not-So-Simple
call a file and it's included. When we do this in PHP there are two
Validation
functions we need to talk about: include() and require(). The
4 Functions
difference between these two functions is subtle but important, so let's
5 Closing Advice
take a closer look. The require() function works in a XSSI-like way;
files are included as part of the original document as soon as that file is
parsed, regardless of its location in the script. So if you decide to place
a require() function inside a conditional loop, the external file will be
included even if that part of the conditional loop is false.
The include() function imports the referenced file each time it is
encountered. If it's not encountered, PHP won't bother with it. This
means that you can use include in loops and conditional statements,
and they'll work exactly as planned.
Finally, if you use require() and the file you're including does not
exist, your script will halt and produce an error. If you use include(),
your script will generate a warning, but carry on. You can test this
yourself by trying the following script. Run the script, then replace
include() with require() and compare the results.
<html>
<body>
<?php
include("emptyfile.inc");
echo "Hello World";
?>
</body>
</html>
19. I like to use the suffix .inc with my include files so I can separate them
from normal PHP scripts. If you do this, make sure that you set your
Web server configuration file to parse .inc files as PHP files. Otherwise,
hackers might be able to guess the name of your include files and
display them through the browser as text files. This could be bad if
you've got sensitive information - such as database passwords -
contained in the includes.
So what are you going to do with include files? Simple! Place
information common to all pages inside them. Things like HTML
headers, footers, database connection code, and user-defined functions
are all good candidates. Paste this text into a file called header.inc.
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
?>
<html>
<head>
<title>
<?php echo $title ?>
</title>
</head>
<body>
<center><h2><?php echo $title ?></h2></center>
Then create another file called footer.txt that contains some
appropriate closing text and tags.
Now let's create a third file containing the actual PHP script. Try the
following code, making sure that your MySQL server is running.
<?php
$title = "Hello World";
include("header.inc");
$result = mysql_query("SELECT * FROM employees",$db);
echo "<table border=1>n";
echo "<tr><td>Name</td><td>Position</tr>n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</tr>n", $myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>n";
include("footer.inc");
?>
21. PHP Version 3.0.6
by Rasmus Lerdorf, Andi Gutmans, Zeev Suraski, Stig Bakken, Shane Caraveo, Jim Winstead, and
countless others.
System: Windows 95/98 4.10
Build Date: Dec 28 1998
Extensions
Extensions Additional Information
Allow persistent links: Yes
Persistent links: 0/Unlimited
MySQL
Total links: 0/Unlimited
Client API version: 3.22.9-beta
Basic Functions No additional information.
PHP_DL Dynamic Library support enabled.
PHP_dir No additional information.
PHP_filestat No additional information.
PHP_file No additional information.
PHP_head No additional information.
Sendmail Internal Sendmail support for Windows 4
Debugger No additional information.
Syslog No additional information.
Unified ODBC Support active (compiled with win32 ODBC)
allow_persistent: 1
ODBC/odbc
max_persistent: -1
max_links: -1
Regular Expressions No additional information.
bcmath No additional information.
browscap No additional information.
PHP_pack No additional information.
Win32 COM No additional information.
24. HTTP_REFERER http://localhost/
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
HTTP_ACCEPT_ENCODING gzip, deflate
HTTPS off
INSTANCE_ID 1
LOCAL_ADDR 127.0.0.1
C:WINDOWS;C:WINDOWSCOMMAND;C:PROGRAM
PATH
FILESMTS
PATH_INFO /test.php3
PATH_TRANSLATED C:graemes_machinehtmltest.php3
PROMPT $p$g
REMOTE_ADDR 127.0.0.1
REMOTE_HOST 127.0.0.1
REQUEST_METHOD GET
SCRIPT_NAME /test.php3
SERVER_NAME localhost
SERVER_PORT 80
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/4.0
TEMP C:WINDOWSTEMP
TMP C:WINDOWSTEMP
winbootdir C:WINDOWS
windir C:WINDOWS
PHP Variables
Variable Value
PHP_SELF /test.php3
PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of:
25. A) the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option)
any later version.
B) the PHP License as published by the PHP Development Team and
included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of both licenses referred to here.
If you did not, or have any questions about PHP licensing, please
contact core@php.net.
26. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 2
by Graeme Merrall
this article for free.
-------------------------
Page 2 — Stay Informed
•Overview
•Lesson 1 Take a look at this script.
•Lesson 2
1 Getting Loopy
2 Stay Informed
3 Link Intelligently <html>
4 Throw in Some Forms
5 Make the Forms Smarter
6 All Together Now <body>
•Lesson 3
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
27. echo "<table border=1>n";
echo "<tr><td>Name</td><td>Position</td></tr>n";
do {
printf("<tr><td>%s %s</td><td>%s</tr>n", $myrow["first"], $myrow["last"], $myrow["address"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>n";
} else {
echo "Sorry, no records were found!";
}
?>
</body>
</html>
29. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 2
by Graeme Merrall
this article for free.
-------------------------
Page 3 — Link Intelligently
•Overview
We're going to take that looping power we just learned and use it in a
•Lesson 1 more practical example. But before we proceed here, you should know
how to work with forms, the querystring, and the GET and POST
•Lesson 2 methods. Jay covered this not long ago, so go take a look at his article
1 Getting Loopy if this is unfamiliar to you.
2 Stay Informed
3 Link Intelligently Right now I'm going to work with the querystring. As you should know,
4 Throw in Some Forms there are three ways to get information into the querystring. The first
5 Make the Forms Smarter is to use the GET method in a form. The second is to type the
6 All Together Now information into the URL on your browser. And third, you can embed a
querystring in a standard link. Just make the anchor tag look
•Lesson 3 something like this: <a
href="http://my_machine/mypage.php3?id=1">. We're going to use
this technique right now.
First off, lets query our database again and list the employee names.
Look at the following script. Much of this should look pretty familiar by
now.
30. <html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<a href="%s?id=%s">%s %s</a><br>n", $PHP_SELF, $myrow["id"], $myrow["first"],
$myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>
</body>
</html>
31. Everything's about the same except the printf function, so let's look
at it in some detail.
First notice that each quotation mark is preceeded by a backslash. The
backslash tells PHP to display the character following it, rather than
treat it as part of the code. Also note the use of the variable
$PHP_SELF. This variable, which stores the script's name and location,
is passed along with every PHP page. It's helpful here because we just
want this file to call itself. Using $PHP_SELF, we can be sure that will
happen, even if the file is moved to another directory - or even another
machine.
As I just mentioned, these links will recall the page. On the second
time through, however, some information will be added to the
querystring.
PHP does a nifty thing when it sees a name=value pair in the
querystring. It automatically creates a variable with the name and
value the querystring indicated. This feature allows us to test if it's the
first or second time through this page. All we have to do is ask PHP if
the variable $id exists.
Once I know the answer to that question, I can display a different set
of information the second time through. Here's how:
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
32. // display individual record
if ($id) {
$result = mysql_query("SELECT * FROM employees WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
printf("First name: %sn<br>", $myrow["first"]);
printf("Last name: %sn<br>", $myrow["last"]);
printf("Address: %sn<br>", $myrow["address"]);
printf("Position: %sn<br>", $myrow["position"]);
} else {
// show employee list
$result = mysql_query("SELECT * FROM employees",$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do {
printf("<a href="%s?id=%s">%s %s</a><br>n", $PHP_SELF, $myrow["id"], $myrow["first"],
$myrow["last"]);
} while ($myrow = mysql_fetch_array($result));
} else {
// no records to display
echo "Sorry, no records were found!";
}
}
?>
34. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 2
by Graeme Merrall
this article for free.
-------------------------
Page 4 — Throw in Some Forms
•Overview
We've managed to get data from a database without much difficulty.
•Lesson 1 But what about sending data the other way? It's not a problem with
PHP.
•Lesson 2
1 Getting Loopy
First let's create a page with a simple form.
2 Stay Informed
3 Link Intelligently
4 Throw in Some Forms <html>
5 Make the Forms Smarter
6 All Together Now <body>
•Lesson 3
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
</body>
</html>
Note the use of $PHP_SELF again. Like I said in Lesson 1, you can use
PHP anywhere inside your HTML code. You'll also notice that each form
element matches the field name in the database. This is not
compulsory; it's just a good idea so you can get your head around your
code later on.
Also notice that I've given the Submit button a name attribute. I've
done this so I can test for the existence of a $submit variable. That
way, when the page is called again, I'll know whether someone used
this form.
I should mention that you don't have to have a page that loops back
on itself. You can span two, three, or more pages, if you like. This way
everything stays compact.
OK, let's add some code that will check for the form input. Just to
prove that the form input does make it through, I'll dump all the
variables to the screen with $HTTP_POST_VARS. This is a useful
debugging feature. If you ever need to see all the variables on a page,
35. use $GLOBALS.
<html>
<body>
<?php
if ($submit) {
// process form
while (list($name, $value) = each($HTTP_POST_VARS)) {
echo "$name = $value<br>n";
}
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Address:<input type="Text" name="address"><br>
Position:<input type="Text" name="position"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>
Now that this is looking good, let's take the form information and post
it to the database.
<html>
<body>
<?php
if ($submit) {
// process form
37. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 2
by Graeme Merrall
this article for free.
-------------------------
Page 5 — Make the Forms Smarter
•Overview
Throughout this tutorial, I've been loading the SQL statement into a
•Lesson 1 variable ($sql) before firing the query at the database with
mysql_query(). This is useful for debugging. If something goes wrong,
•Lesson 2 you can always echo the SQL to the screen to examine it for mistakes.
1 Getting Loopy
2 Stay Informed
We already know how to get data into the database. Now let's try
3 Link Intelligently modifying records that are already in the database. Editing data
4 Throw in Some Forms combines two elements we've already seen: displaying data on the
5 Make the Forms screen and sending data back to the database via form input. However,
Smarter editing is slightly different in that we have to show the appropriate
6 All Together Now data in the form.
•Lesson 3
First, let's recycle the code from Lesson 1 to display the employee
names on our page. But this time through, we're going to populate our
form with employee information. It should look a little like this:
<html>
<body>
39. // display list of employees
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href="%s?id=%s">%s %s</a><br>n", $PHP_SELF, $myrow["id"], $myrow["first"],
$myrow["last"]);
}
}
?>
</body>
</html>
We just echoed the field information into the value attribute of the
each element, which was fairly easy. Let's build on this a little more.
We will add the ability to send the edited code back to the database.
Again, we're going to use the Submit button to test whether we need
to process the form input. Also note the slightly different SQL
statement we use.
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
40. mysql_select_db("mydb",$db);
if ($id) {
if ($submit) {
$sql = "UPDATE employees SET
first='$first',last='$last',address='$address',position='$position' WHERE id=$id";
$result = mysql_query($sql);
echo "Thank you! Information updated.n";
} else {
// query the DB
$sql = "SELECT * FROM employees WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type=hidden name="id" value="<?php echo $myrow["id"] ?>">
First name:<input type="Text" name="first" value="<?php echo $myrow["first"] ?>"><br>
Last name:<input type="Text" name="last" value="<?php echo $myrow["last"] ?>"><br>
Address:<input type="Text" name="address" value="<?php echo $myrow["address"] ?>"><br>
Position:<input type="Text" name="position" value="<?php echo $myrow["position"] ?>"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
41. }
} else {
// display list of employees
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href="%s?id=%s">%s %s</a><br>n", $PHP_SELF, $myrow["id"], $myrow["first"],
$myrow["last"]);
}
}
?>
</body>
</html>
And that's that. We've managed to combine most of the features we've
seen into one script. You can also see how we've used an if()
statement inside another if() statement to check for multiple
conditions.
It's time to put it all together and make one killer script.
next page»
43. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 2
by Graeme Merrall
this article for free.
-------------------------
Page 6 — All Together Now
•Overview
We'll finish up this lesson by putting everything into a single page that
•Lesson 1 can add, edit, and remove entries from the database. It's an extension
of what we've covered so far and makes for a good review. Let's take a
•Lesson 2 look.
1 Getting Loopy
2 Stay Informed
3 Link Intelligently <html>
4 Throw in Some Forms
5 Make the Forms Smarter <body>
6 All Together Now
•Lesson 3 <?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
if ($submit) {
44. // here if no ID then adding else we're editing
if ($id) {
$sql = "UPDATE employees SET
first='$first',last='$last',address='$address',position='$position' WHERE id=$id";
} else {
$sql = "INSERT INTO employees (first,last,address,position) VALUES
('$first','$last','$address','$position')";
}
// run SQL against the DB
$result = mysql_query($sql);
echo "Record updated/edited!<p>";
} elseif ($delete) {
// delete a record
$sql = "DELETE FROM employees WHERE id=$id";
$result = mysql_query($sql);
echo "$sql Record deleted!<p>";
} else {
// this part happens if we don't press submit
if (!$id) {
// print the list if there is not editing
$result = mysql_query("SELECT * FROM employees",$db);
while ($myrow = mysql_fetch_array($result)) {
printf("<a href="%s?id=%s">%s %s</a> n", $PHP_SELF, $myrow["id"], $myrow["first"],
$myrow["last"]);
45. printf("<a href="%s?id=%s&delete=yes">(DELETE)</a><br>", $PHP_SELF, $myrow["id"]);
}
}
?>
<P>
<a href="<?php echo $PHP_SELF?>">ADD A RECORD</a>
<P>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
if ($id) {
// editing so select a record
$sql = "SELECT * FROM employees WHERE id=$id";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$first = $myrow["first"];
$last = $myrow["last"];
$address = $myrow["address"];
$position = $myrow["position"];
// print the id for editing
48. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 5 — Load Up a Database
•Overview
So now we're ready to plug in MySQL. One handy way of knowing what
•Lesson 1 options are available in PHP and what's going on in your server is to
1 Introducing PHP and use the phpinfo() function. Create a script with the following:
MySQL
2 Installing MySQL
3 Installing PHP <html>
4 Your First Script
<body>
5 Load Up a Database
6 Pull It Back Out
•Lesson 2 <?php
•Lesson 3 phpinfo();
?>
</body>
</html>
49. Save and view this script through your Web server. You'll see a page
filled with useful and interesting information like this. This info tells all
about your server, internal Web server environment variables, the
options that are compiled, and on and on. In the first section,
Extensions, look for a line beginning with MySQL. If this is missing,
then for some reason MySQL hasn't made it into PHP. Go back and
review the installation steps and check the PHP documentation to see if
you missed anything.
If MySQL is there, then you're ready to roll.
Before we can get data out of MySQL, we have to put data in it.
There's really no easy way to do it at this stage. Most PHP scripts come
with what's known as a dump file that contains all the data required to
create and populate a MySQL database. The ins and outs of this
process are really outside the scope of this tutorial, so I'll just do it for
you.
MySQL uses its own user permissions table. At setup, a default user
(root) is automatically created with no password. It's up to the
database administrator to add other users with various permissions,
but I could write a whole other article on that, so we'll stick with using
the root user. If you set up your own server and database, it's vital
that you assign a password to the root user.
Anyway, let's get on with the database. For Win32 users, I'm sorry,
but this requires some DOS work. You'll have to use a DOS window or
type everything in the Run window. Don't forget to type in the path to
the location of the MySQL/bin directory with your commands. Unix
users can work from the MySQL bin directory, but you may have to
start each command with ./ so the programs run.
The first thing we need to do is create the actual database. From the
command line, type:
mysqladmin -u root create mydb
That creates a database called "mydb." The flag tells MySQL that we're
doing this as the root user.
51. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 1
by Graeme Merrall
this article for free.
-------------------------
Page 6 — Pull It Back Out
•Overview
•Lesson 1 OK, now we've got our data in the database. Let's do something with it.
1 Introducing PHP and Copy and paste the following into a text file and save it in your Web server
MySQL document tree with a .php3 extension.
2 Installing MySQL
3 Installing PHP
4 Your First Script
5 Load Up a Database
<html>
6 Pull It Back Out
•Lesson 2
<body>
•Lesson 3
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>n", mysql_result($result,0,"last"));
printf("Address: %s<br>n", mysql_result($result,0,"address"));
printf("Position: %s<br>n", mysql_result($result,0,"position"));
?>
</body>
</html>
53. SEARCH: webmonkey the web JUMP TO A TOPIC:
Choose Topic
home / programming / php /
PHP PHP/MySQL Tutorial
-------------------------
Print
Lesson 3
by Graeme Merrall
this article for free.
-------------------------
Page 2 — Simple Validation
•Overview
•Lesson 1 Imagine for a moment that we've got our database nicely laid out and we're now
requesting information from users that will be inserted into the database. Further, let's
•Lesson 2 imagine that you have a field in your database waiting for some numeric input, such as
a price. Finally, imagine your application falling over in a screaming heap because some
•Lesson 3 smart aleck put text in that field. MySQL doesn't want to see text in that portion of your
1 A Place for Everything SQL statement - and it complains bitterly.
2 Simple Validation
3 Not-So-Simple
What to do? Time to validate.
Validation
4 Functions
5 Closing Advice
Validation simply means that we'll examine a piece of data, usually from an HTML form,
and check to make sure that it fits a certain model. This can range from ensuring that a
element is not blank to validating that an element meets certain criteria (for example,
that a numeric value is stipulated or that an email address contains an @ for an email
address).
Validation can be done on the server side or on the client side. PHP is used for server-
side validation, while JavaScript or another client-based scripting language can provide
client-side validation. This article is about PHP, so we're going to concentrate on the
server end of things. But if you're looking for some ready-made, client-side validation
scripts, check out the Webmonkey code library.
Let's ignore our database for the moment and concentrate on PHP validation. If you
wish, you can add additional fields to our employee database quite simply by using the
MySQL ALTER statement - that is, if you want to commit to the values that we'll
validate.
There are several useful PHP functions we can use to validate our data, and they range
from simple to highly complex. A simple function we could use might be strlen(),
which tells us the length of the variable.
A more complex function would be ereg(), which uses full regular expression handling
for complex queries. I won't delve into the complexities of regex here, as entire books
have been written on the subject, but I will provide some examples on the next page.
Let's start with a simple example. We'll check to see whether a variable does or does not
exist.
<html>
<body>
<?php
if ($submit) {
if (!$first || !$last) {
$error = "Sorry! You didn't fill in all the fields!";