I write a PHP script to display the message like
if the connection is success it display the message Welcome to WampServer, else it gives an error message like Connection error.....
but here when i try to connect the Wampserver, it displayed my Code, as the result.What is the problem here, will you please solve this problem and also please explain me elaborately.
<?php
$db_name="webappdb";
$mysql_user="root";
$mysql_pass="root";
$server_name="localhost";
$con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
if(!$con){
echo "Connection error...".mysqli_connect_error();
}
else{
echo"<h3>Database Connection Success....</h3>"
}
?>
Below is my Code what i used.This code i saved in the folder C:\wamp64\www\webapps
for connected to the data base i used this in the web localhost/webappdb/webapps
If you are using edit plus then there is no need to extend your php file with .php extension. suppose your are using a note pad to write php script to connect Wampserver or to got a connection success report from server it is necessary to extend the file with .php other wise it gives or behave abnormally.Gives result like what your are mentioned above.
First my suggestion is if your are using a note pad to write a any coding extend that file with that jar file like php with .php and java .java like