Here's My setup I have gone over it twice already and have come up with nothing. I am currently working on a LAMP stack and most of the configurations have been done properly. I have two files 1. connect.php 2. registration.php
- code of connect.php is as follows:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$hostname="localhost"; //local server name
$username="user_name"; //mysql username
$password="my_password"; //mysql password
$database="my_database"; //database name
// Create Connection to DB using an Object
$con= mysqli_connect($hostname,$username,$password); //do i need to pass database name also as an argument to this?
//Check Connection
if(mysqli_connect_errno()){
echo"Failed to connect! due to : " . mysqli_connect_errno();
} else{
echo"Connected!";
}
?>
- code of registration.php is as follows:
<?php //start php tag
include("/var/www/calculator/connect.php"); //using absolute path to avoid any confusion
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Connected! on Registration Page"); //executes till here with no problems
}
if (mysqli_query($conn, "CREATE table users"))
{
printf("Query Executed!", mysqli_affected_rows($conn))
}
mysqli_close($link);
?>
Some have suggested to take a look at the apache server logs here is the last 10 output of the logs
::1 - - [24/Feb/2020:13:14:41 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:43 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:44 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:14:45 +0530] "GET /registration.php HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
::1 - - [24/Feb/2020:13:15:37 +0530] "-" 408 0 "-" "-"
::1 - - [24/Feb/2020:13:15:37 +0530] "-" 408 0 "-" "-"
I need help on why my queries are not getting executed despite my code having no coding errors or query structure errors.