Connecting Database to Godaddy

I have been connecting my form with MySQL database. I am trying to host my project website on Godaddy. I found many resources but none of them helped. The database is not getting updated after signup from the form. Here is what I tried.

I doubt that is it not connecting to the database as it doesn’t give any error. Code for Sign-In

<?php  $servername ="localhost"; $username = "username"; $password = "password"; $dbname = "ms";  $conn = new mysqli($servername, $username, $password, $dbname);  if($conn->connect_error){     die("connection failed"); }  $email = $_POST["email"]; $password = $_POST["password"];    $sql = mysqli_query($conn, "SELECT count(*) as total from customers WHERE email = '".$email."' and      password = '".$password"'");  $row = mysqli_fetch_array($sql);  if($row["total"] > 0){     ?>     <script>         alert('Login successful');     </script>          <?php } else{     ?>     <script>         alert('Login failed');     </script>     <?php }  ?> 

Code for Sign-Up

<?php    $servername ="localhost"; $username = "username"; $password = "password"; $dbname = "ms";  $conn = new mysqli($servername, $username, $password, $dbname);  if($conn->connect_error){     die("connection failed"); }  $id = $_POST["1"]; $name = $_POST["name"]; $email = $_POST["email"]; $password = $_POST["password"];   $sql = "INSERT INTO customers(`customer_id`, `customer_name`, `customer_email`, `customer_password`) VALUES ('$id', '$name', '$email', '$password')";   if($conn->query($sql) === TRUE){     ?>     <script>         alert('Values have been inserted');     </script>     <?php } else{     ?>     <script>         alert('Values did not insert');     </script>     <?php }   ?> 

I’m also interested in implementing login using Google, Facebook and Twitter etc., and storing the user data into my database. Any suggestions or related links would be really helpful.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.