Connecting MySQL with PHP
Query
$connection = mysqli_connect ('localhost','username','password','database');
You need not understand in details how the script works at this stage but recognize that it contains sensitive information . For this reason it should not be placed
in the web server WWW directory like all others PHP script , where its contents may be accessible but placed instead safely in /WWW parent directory .
For Example
in the App Server directory rather than in the
"C:/AppServer/WWW" directory .
Any PHP script can incorporate another PHP Script by using a required statement to specify the other script path . This feature can be used to good effect to incorporate the connection script without revealing its sensitive information .
Launch plain text editor and create a connection script describing the parameters from the previous pages
<?php
$connection = mysqli_connect('localhost','root','admin@123','site_db');
if($connection)
{
echo Connection Successful
}
else
{
echo Connection Failed
}
?>
Connection Successful MySQL With PHP
🖕
ReplyDelete👍
ReplyDelete