Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29539

Database entry failed [duplicate]

$
0
0

This question already has an answer here:

I have created a mysql database instance in AWS free tier account. Which listens on port 3306. And I have one instance up and running with mysql Ver 14.14 Distrib 5.7.28, for Linux (x86_64) using EditLine wrapper, PHP 5.4.16 (cli), and version: Apache/2.4.39 () Server. I have a sign up page and a action_page.php to get the details from user and store it in DB.

Config file :

<?php
$connection = mysql_connect('DB-endpoint:3306', 'admin', 'pass');
if (!$connection) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($connection);
?>

Inserting data :

<?php
  include('config.php');            
    if (isset($_POST['submit'])) {
        $name = $_POST['uname'];
        $pass = $_POST['psw'];
        $bool = true;
        if ($bool) {
                     mysqli_query($connection, "insert into login_detail(name,pass) values ('$name','$pass')");

        Print '<script>alert("Successfully Added!");</script>';
        Print '<script>window.location.assign("");</script>';
                   }
      }

?>

After entering the signup details the data's are not storing on my DB


Viewing all articles
Browse latest Browse all 29539

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>