• Contact Editorial Team
  • Advertise on YNOT
  • Submit PR
Thursday, March 26, 2026
  • Login
  • Register
YNOT
  • Home
  • Industry News
    • Porn Star & Adult Talent News
    • Adult Business News
    • Adult Novelty News
    • Adult Industry Legal News
    • Tech News for Adult Webmasters
    • Video Game News for Adults
    • EU News
  • PR Wire
  • Podcasts
  • Industry Guides
  • Newsletters
No Result
View All Result
  • Home
  • Industry News
    • Porn Star & Adult Talent News
    • Adult Business News
    • Adult Novelty News
    • Adult Industry Legal News
    • Tech News for Adult Webmasters
    • Video Game News for Adults
    • EU News
  • PR Wire
  • Podcasts
  • Industry Guides
  • Newsletters
No Result
View All Result
YNOT
No Result
View All Result
Home YNOT Features YNOT University

Introduction to PHP and MYSQL – Part 2

admin by admin
July 11, 2002
in YNOT University
491
SHARES
Share on FacebookShare on Twitter

PHP on the half-shell

[Part 1]

PHP is a server-side language. Simply put, this means that instead of creating a static HTML page that surfers will see over and over again, PHP code is processed by your server to build HTML pages on the fly before delivering them to the client.PHP on the half-shell

[Part 1]

PHP is a server-side language. Simply put, this means that instead of creating a static HTML page that surfers will see over and over again, PHP code is processed by your server to build HTML pages on the fly before delivering them to the client. This article will focus on the syntax and fundamentals of PHP, and will require that PHP be installed on your server. Please note that there are many ways to accomplish the same tasks in PHP. This article is a quick start guide and I encourage the user to consult http://www.php.net for a more in-depth look at the language itself.

Using PHP

First, let’s examine how PHP is used within an HTML page. Let us consider these two code listings:

File 1: helloworld.html

<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
<BODY>
<center>Hello World</center>
</BODY>
</HTML> File 2: helloworld.php

<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
<BODY>
<?PHP
//This is our code
Print “<center>Hello World</center>”;
?>
</BODY>
</HTML>

As an HTML developer, File 1 will look familiar to you. Both of these files output the same exact information to the browser, and when looking at the source for File 1 it will look indistinguishable from the source of File 2. The important difference is that File2 has been generated in a dynamic fashion with PHP code. Please note that all PHP code must appear between the <?PHP ?> tags. Each line of code must end with the semi-colon (;), and the comment block “//This is our code” will never appear in our final browser output. I strongly recommend using comments within your code as an internal documentation resource.

Variables

Variables are a temporary repository of data. They are flexible in their use and can be used to hold alpha, numeric or alphanumeric data. Consider the following code:

<?PHP
//Sample of using Variables
$myname = “Bob”;
$myage = 43;
$nextyear = $myage + 1;

echo “My name is “.$myname. ” and I am “.$myage. ” years old. Next year I will be “.$nextyear;
?>

Note that I have used the echo command to output information to the browser, instead of the print command in this listing. We are using a combination of literal and variable values to output the result of this code:

My name is Bob and I am 43 years old. Next year I will be 44

The literal value of “My name is “ is concatenated, or joined to, the variable value $myname by the use of the period. Variables are case sensitive, meaning simply that $myname and $Myname would be considered two different variables. Finally, variables can be used in mathematical equations as demonstrated with $nextyear=$myage+1.

Repetitive Iterations

Since the earliest days of computers, one of the most powerful uses of the computer was to repeat a series of repetitive actions. PHP offers several ways to accomplish this, these are called FOR LOOPS, WHILE LOOPS and DO WHILE LOOPS. We will examine the FOR LOOP here and I suggest you look into the subtle differences between the three methodologies on your own to decide what is best for any given situation.

Consider the following code snippet:

<?PHP
//Sample of the FOR LOOP
for($myvalue=2; $myvalue<=20; $myvalue += 2)
{
echo “The value is now set to “.$myvalue.”<br>”;
}
?>

The FOR LOOP, allows us to set three parameters. The loop sets the initial value of our variable, how high the value will increment and the amount by which we will increment that value. Execute this code on your server and you will get this output:

The value is now set to 2
The value is now set to 4
The value is now set to 6
The value is now set to 8
The value is now set to 10
The value is now set to 12
The value is now set to 14
The value is now set to 16
The value is now set to 18
The value is now set to 20

Conditions and Branches

The second thing that computers have always been good at, is evaluating a given set of data and making simplistic decisions on what to do based on that information. The two basic forms of this in PHP are the IF statement and the SWITCH statement. I will cover the IF statement here and suggest that readers research the use of the SWITCH statement as it is a very powerful feature to learn to use.

Examine this code:

<?PHP
//Sample of Conditions and Branching
for($myvalue=2; $myvalue<= 20; $myvalue += 2)
{
if($myvalue < 10)
{
echo “The value “.$myvalue. ” is less than 10<br>”;
}
elseif($myvalue >= 10 && $myvalue < 16)
{
echo “The value “.$myvalue. ” is greater than or equal to 10 and less than 16<br>”;
}
else
{
echo “The value “.$myvalue.” is greater than or equal to 16<br>”;
}
}
?>

The If statement allows you to set up multiple conditions. If this = that, else if this = those, or else this = something all together. Note in the elseif() block, that I have set two conditions. This >= that AND this < those. With the If statement, you can create complex branches based upon decisions made depending upon the data you are evaluating. The output of this code will look like this:

The value 2 is less than 10
The value 4 is less than 10
The value 6 is less than 10
The value 8 is less than 10
The value 10 is greater than or equal to 10 and less than 16
The value 12 is greater than or equal to 10 and less than 16
The value 14 is greater than or equal to 10 and less than 16
The value 16 is greater than or equal to 16
The value 18 is greater than or equal to 16
The value 20 is greater than or equal to 16

Summary

PHP is a powerful language that offers dynamic delivery of content. PHP has syntax, or a language, of it’s own that it uses to deliver HTML documents to the surfer’s browser and allows you the flexibility through the use of Variables, Repetitive Iterations and Conditional Branches to write professional quality web sites.

Our next chapter will cover processing HTML forms to retrieve and manipulate data that you gather from the user. Until the next time, keep burning the Midnight oil and I will be seeing you on the YNOTMasters discussion boards.

— Midnight

Bob Cristello is a recognized leader in the programming world. His articles on programming have appeared in Byte, InfoWorld, Avatar, Computer Telephony and Visual Basic Programmers Journal. He is a former keynote speaker for the Microsoft nationwide broadcast series. Bob’s clients have included Prodigy Online, Arthur Anderson and Nellie Mae. He recently retired as the Head of the Internet Development Group at REBAR and lives just outside of Boston with his wife, Elsibeth. Most days, Bob and Elsibeth can be found in irc.webmasterlive.com in #adultnetsurprise and are better known as Midnight and Kandi. Bob can be reached by emailing midnighterotica@hotmail.com or via ICQ# 118997859.

Share196Tweet123
admin

admin

YNOT Admin wields his absolute power without mercy. When he's not busy banning spam comments to hell he enjoys petting bunnies and eating peanut butter. He recommends everyone try the YNOT Mail (ynotmail.com) email marketing platform and avoid giving their money to mainstream services that hate adult companies.

Related Posts

Adult Business News

UK Online Safety Act Cuts Pornhub Traffic 36% as Age Verification Takes Effect

December 13, 2025
Adult Business News

The Cambassador: Lindsey Banks, Flirt4Free and Brand Representation

September 5, 2018
Adult Business News

ImLive’s Mere Menezes Siqueira Manages Models, Makes the Machine Work

August 23, 2018
Corey Silverstein of Adult.law
Adult Business News

Silverstein Says: 3 Legal Issues Cam Companies, Models Must Pay Attention To

August 22, 2018
Load More

SPONSOR

INDUSTRY EVENTS

Currently Playing

YNOT Summit Model Track: Nerds Dig Sexy Gamers

YNOT Summit Model Track: Nerds Dig Sexy Gamers

01:05:46

YNOT Summit Webmaster Track: Understanding Webcam Business Models

00:51:11

YNOT Summit Model Track: Cam Law 101

01:26:24

SPONSOR

POPULAR NEWS

Chelsea Poe Continues Re-release Campaign with “The Dinner Party”

March 26, 2026
Tech Savy Crew Expands Adult SEO Services With 'AI-First Strategy'

Tech Savy Crew Expands Adult SEO Services With ‘AI-First Strategy’

March 26, 2026
Honey Play Box Officially Launches the “Vibrosa Mini”

Honey Play Box Officially Launches the “Vibrosa Mini”

March 26, 2026

Sponsor

YNOT YNOT

QUICK LINKS:

  • About YNOT
  • Terms of Use
  • Privacy Policy
  • Editorial Team
  • Advertise on YNOT
  • Sitemap

FRIENDS OF YNOT:

  • Best Adult Cams
  • Live Porn
  • Adult Reviews
  • Adult Email Marketing
  • Discounted Porn
  • vr porn sites
  • European Adult Biz Magazine

FRIENDS OF YNOT:

  • Rabbits Reviews
  • XXX Job Interviews
  • Adult Site Broker
  • Femdom
  • Paid Porn Sites
  • Live Sex
  • Cam girl sites
  • AI Girlfriend
  • live porn Vibra Game

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • Home
  • Adult Business News
  • Adult Industry Legal News
  • Adult Novelty News
  • Porn Star & Adult Talent News
  • Tech News for Adult Webmasters
  • Video Game News for Adults
  • Interviews
  • Opinions
  • YNOT Industry Wire
  • Newsletters

Copyright © 2026 YNOT Group LLC.

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.