Back to html php sql
This presentation is the property of its rightful owner.
Sponsored Links
1 / 12

Back to html / php / sql PowerPoint PPT Presentation


  • 45 Views
  • Uploaded on
  • Presentation posted in: General

Back to html / php / sql. HTML Hello World. <html> <head> <title>Page Title</title> </head> <body> <h1>Hello World!!</h1> </body> </html>. A little more. <html> <head> < title> Page Title </title>

Download Presentation

Back to html / php / sql

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Back to html php sql

Back to html / php / sql


Html hello world

HTML Hello World

<html>

<head>

<title>Page Title</title>

</head>

<body>

<h1>Hello World!!</h1>

</body>

</html>


A little more

A little more

<html>

<head>

<title> Page Title </title>

<link rel="stylesheet" href="mystyle.css" type="text/css" />

</head>

<body>

<p>My name is: <strong>Elizabeth Thiry</strong></p>

<p>My user ID is: exn152</p>

<p>I am a student at <a href="http://www.personal.psu.edu/exn152"> PSU </a></p>

</body>

</html>


Back to html php sql

CSS

p {

color:#666;

font-size:.8em;

padding-left:9em;

}

a {

color: green;

text-decoration:overline;

}

strong {

color: purple;

font-size:larger;

}


Hello world with html and php

Hello World With HTML and PHP

<html>

 <head>

  <title>PHP Test</title>

 </head>

 <body>

 <?php echo '<p>Hello World</p>'; ?> 

 </body>

</html>


Forms

Forms

<html>

<head>

<title>PHP Test</title>

</head>

<body>

<h1>Form Page</h1>

<form action=“action.php" method="post">

<p>Select a day:

<select name="weekday">

<option>Sunday</option>

<option>Monday</option>

<option>Tuesday</option>

<option>Wednesday</option>

</select><br />

First Name: <input name="fname" type="text" /> <br />

Last Name: <input name="lname" type="text" /> <br />

<input type="submit" />

</form>

</body>

</html>


Action php

Action.php

<html>

<head>

<title>PHP Test</title>

</head>

<body>

<h1>My PHP Action Page</h1>

<p>

<?php

$weekday = $_POST['weekday'];

$fname = $_POST['fname'];

$lname = $_POST['lname'];

echo "You selected ". $weekday . "<br />";

echo "Thank you ". $fname ." ". $lname ."<br />";

?>

</p>

</body>

</html>


Connecting to sql

Connecting to SQL

<html>

<head>

<title>Lab 5</title>

</head>

<body>

<h1>Form Page</h1>

<form action="lab5_action.php" method="post">

<p>Select a day:

<select name="weekday">

<?php


Connecting to sql cont

Connecting to SQL.. Cont….

<?php

$myServer = "updb1.up.ist.psu.edu";

$myUser = "sqlnna102";

$myPass = "snsmR8Wf";

$myDB = "nna102";

//connection to the database

$dbhandle = mssql_connect($myServer, $myUser, $myPass)

or die("Couldn't connect to SQL Server on $myServer");

//select a database to work with

$selected = mssql_select_db($myDB, $dbhandle)

or die("Couldn't open database $myDB");


Connecting to sql cont1

Connecting to SQL.. Cont….

//declare the SQL statement that will query the database

$query = "SELECT id, day ";

$query .= "FROM Weekdays ";

//execute the SQL query and return records

$result = mssql_query($query);

$numRows = mssql_num_rows($result);

echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";

//display the results

while($row = mssql_fetch_array($result))

{

echo "<option>" . $row["day"] . "</option>";

}

//close the connection

mssql_close($dbhandle);

?>


Connecting to sql cont2

Connecting to SQL.. Cont….

</select><br />

First Name: <inputname="fname" type="text" /> <br />

Last Name: <inputname="lname" type="text" /> <br />

<input type="submit" />

</form>

</body>

</html>


Displaying in a table

Displaying in a table

echo "<table border='1'>

<tr>

<th>FirstName</th>

<th>LastName</th>

</tr>";

//display the results

while($row = mssql_fetch_array($result))

{

echo "<tr>";

echo "<td>" . $row['PlayerFirstName'] . "</td>";

echo "<td>" . $row['PlayerLastName'] . "</td>";

echo "</tr>";

}

echo "</table>";

//close the connection

mssql_close($dbhandle);

?>


  • Login