You guys asked me to create an updated tutorial on how to install XAMPP, so here it is. I wanted to cover everything though, so I show how to install XAMPP. I also cover how to fix all of the common errors. I show how to setup Administrator accounts on Windows 10 and then allow them to run apps, which is normally restricted. Then using phpMyAdmin we create user accounts and a database. To round out the tutorial I then create PHP / MySQL configuration files and PHP scripts that are used to query and update the database.
All of the code used among other things, follows the video below.
If you like videos like this, it helps me when you tell Google with a click here [googleplusone]
Code From the Video
Fixing the Registry Keys for the Administrator account
To use Microsoft Edge as the Administrator you have to change a few registry registry keys.
Change the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Create a DWORD value if it doesn’t exist called FilterAdministratorToken
and set the value to 1
Change the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\UIPI\
Change the Default string key to 0x00000001(1)
---------- mysqli_connect.php ----------
<?php
// Opens a connection to the database
// Since it is a php file it won't open in a browser
// It should be saved outside of the main web documents folder
// and imported when needed
/*
Command that gives the database user the least amount of power
as is needed.
GRANT INSERT, SELECT, DELETE, UPDATE ON test3.*
TO 'studentweb'@'localhost'
IDENTIFIED BY 'turtledove';
SELECT : Select rows in tables
INSERT : Insert new rows into tables
UPDATE : Change data in rows
DELETE : Delete existing rows (Remove privilege if not required)
*/
// Defined as constants so that they can't be changed
DEFINE ('DB_USER', 'studentweb');
DEFINE ('DB_PASSWORD', 'turtledove');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'test3');
// $dbc will contain a resource link to the database
// @ keeps the error from showing in the browser
$dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME)
OR die('Could not connect to MySQL: ' .
mysqli_connect_error());
?>
---------- getstudentinfo.php ----------
<?php
// Get a connection for the database
require_once('../mysqli_connect.php');
// Create a query for the database
$query = "SELECT first_name, last_name FROM students";
// Get a response from the database by sending the connection
// and the query
$response = @mysqli_query($dbc, $query);
// If the query executed properly proceed
if($response){
echo '<table align="left"
cellspacing="5" cellpadding="8">
<tr><td align="left"><b>First Name</b></td>
<td align="left"><b>Last Name</b></td></tr>';
// mysqli_fetch_array will return a row of data from the query
// until no further data is available
while($row = mysqli_fetch_array($response)){
echo '<tr><td align="left">' .
$row['first_name'] . '</td><td align="left">' .
$row['last_name'] . '</td>';
echo '</tr>';
}
echo '</table>';
} else {
echo "Couldn't issue database query<br />";
echo mysqli_error($dbc);
}
// Close connection to the database
mysqli_close($dbc);
?>
---------- addstudent.php ----------
<html>
<head>
<title>Add Student</title>
</head>
<body>
<form action="http://localhost:1234/studentadded.php" method="post">
<b>Add a New Student</b>
<p>First Name:
<input type="text" name="first_name" size="30" value="" />
</p>
<p>Last Name:
<input type="text" name="last_name" size="30" value="" />
</p>
<p>
<input type="submit" name="submit" value="Send" />
</p>
</form>
</body>
</html>
---------- studentadded.php ----------
<html>
<head>
<title>Add Student</title>
</head>
<body>
<?php
if(isset($_POST['submit'])){
$data_missing = array();
if(empty($_POST['first_name'])){
// Adds name to array
$data_missing[] = 'First Name';
} else {
// Trim white space from the name and store the name
$f_name = trim($_POST['first_name']);
}
if(empty($_POST['last_name'])){
// Adds name to array
$data_missing[] = 'Last Name';
} else{
// Trim white space from the name and store the name
$l_name = trim($_POST['last_name']);
}
if(empty($data_missing)){
require_once('../mysqli_connect.php');
$query = "INSERT INTO students (first_name, last_name) VALUES (?, ?)";
$stmt = mysqli_prepare($dbc, $query);
mysqli_stmt_bind_param($stmt, "ss", $f_name, $l_name);
mysqli_stmt_execute($stmt);
$affected_rows = mysqli_stmt_affected_rows($stmt);
if($affected_rows == 1){
echo 'Student Entered';
mysqli_stmt_close($stmt);
mysqli_close($dbc);
} else {
echo 'Error Occurred<br />';
echo mysqli_error();
mysqli_stmt_close($stmt);
mysqli_close($dbc);
}
} else {
echo 'You need to enter the following data<br />';
foreach($data_missing as $missing){
echo "$missing<br />";
}
}
}
?>
<form action="http://localhost:1234/studentadded.php" method="post">
<b>Add a New Student</b>
<p>First Name:
<input type="text" name="first_name" size="30" value="" />
</p>
<p>Last Name:
<input type="text" name="last_name" size="30" value="" />
</p>
<p>
<input type="submit" name="submit" value="Send" />
</p>
</form>
</body>
</html>