Hello everyone.

I have just bought a new computer and I am currently working on creating an online cloud storage service. Every thing is going fine until I am struck with a problem. At first, registering a new user works and the data is inserted into database but after testing it multiple times, it no loger works for some reason? The thing that struck me is that during the testing period, I did not tamper with any of the codes. After 5 tests, when a new user tries to register, the website says there are no errors but after going into my phpmyadmin, there is nothing there. I have tried everything and I don't know what to do! Please Help



<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="assets/ico/favicon.png">

    <title>GetConnect Unlimited File Hosting</title>

    <link href="assets/css/hover_pack.css" rel="stylesheet">

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="assets/css/main.css" rel="stylesheet">
    <link href="assets/css/colors/color-74c9be.css" rel="stylesheet">    
    <link href="assets/css/animations.css" rel="stylesheet">
    <link href="assets/css/font-awesome.min.css" rel="stylesheet">

    <!-- JavaScripts needed at the beginning
    ================================================== -->
    <script type="text/javascript" src="http://alvarez.is/demo/marco/assets/js/twitterFetcher_v10_min.js"></script>

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyASm3CwaK9qtcZEWYa-iQwHaGi3gcosAJc&sensor=false"></script>
    <script type="text/javascript">
        // When the window has finished loading create our google map below
        google.maps.event.addDomListener(window, 'load', init);

        function init() {
            // Basic options for a simple Google Map
            // For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
            var mapOptions = {
                // How zoomed in you want the map to start at (always required)
                zoom: 11,

                scrollwheel: false,

                // The latitude and longitude to center the map (always required)
                center: new google.maps.LatLng(40.6700, -73.9400), // New York

                // How you would like to style the map. 
                // This is where you would paste any style found on Snazzy Maps.
                styles: [   {       featureType:'water',        stylers:[{color:'#74c9be'},{visibility:'on'}]   },{     featureType:'landscape',        stylers:[{color:'#f2f2f2'}] },{     featureType:'road',     stylers:[{saturation:-100},{lightness:45}]  },{     featureType:'road.highway',     stylers:[{visibility:'simplified'}] },{     featureType:'road.arterial',        elementType:'labels.icon',      stylers:[{visibility:'off'}]    },{     featureType:'administrative',       elementType:'labels.text.fill',     stylers:[{color:'#444444'}] },{     featureType:'transit',      stylers:[{visibility:'off'}]    },{     featureType:'poi',      stylers:[{visibility:'off'}]    }]

            // Get the HTML DOM element that will contain your map 
            // We are using a div with id="map" seen below in the <body>
            var mapElement = document.getElementById('map');

            // Create the Google Map using out element and options defined above
            var map = new google.maps.Map(mapElement, mapOptions);

    <!-- Main Jquery & Hover Effects. Should load first -->
    <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script src="assets/js/hover_pack.js"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>


    <! ========== HEADERWRAP ==================================================================================================== 
    <div id="headerwrap">
        <div class="container">
            <div class="row centered">
                <div class="col-lg-8 col-lg-offset-2 mt">
                    <h1 class="animation slideDown">Please complete the following form to signup for our service.</h1>
                    <form name="register" action="registerprocess.php" method="post">
            <td><input type="text" name="username" maxlength="20" /></td>
            <td><input type="password" name="password1" /></td>

            <td><input type="text" name="email" id="email" /></td>
            <td><input type="submit" value="Register" /></td>

            </div><!-- /row -->
        </div><!-- /container -->
    </div> <!-- /headerwrap -->

    <! ========== BLOG POSTS ==================================================================================================== 

    <! ========== CALL TO ACTION 1 ============================================================================================== 

    <! ========== PORTFOLIO SECTION ============================================================================================= 

    <! ========== BRANDS & CLIENTS =============================================================================================== 

    <! ========== BLACK SECTION ================================================================================================= 
    <div id="black">
        <div class="container">
            <div class="row mt centered">
                <div class="col-lg-4 col-lg-offset-4">
                    <h3>Our Work Process</h3>
                </div><!-- /col-lg-4 -->
            </div><!-- /row -->

            <div class="row mt">
                <div class="col-lg-8 col-lg-offset-2">
                    <p>We strive to ensure you get the cloud storage space you deserve. What ever your needs, you can trust GetConnect as your #1 cloud service!</p>
                </div><! --/col-lg-8 -->
            </div><!-- /row -->
        </div><!-- /container -->
    </div><!-- /black -->

    <! ========== FOOTER ======================================================================================================== 

    <div id="f">
        <div class="container">
            <div class="row">
                <!-- ADDRESS -->
                <div class="col-lg-3">
                        Planet Earth,<br/>

                        <i class="fa fa-mobile"></i> <br/>
                        <i class="fa fa-envelope-o"></i> shay05@sherborneq.org
                </div><! --/col-lg-3 -->

                <!-- TWEETS -->
                <div class="col-lg-3">
                    <h4>Recent Tweets</h4>
                    <div id="showtweets"></div>
                            twitterFetcher.fetch('258157205101088768', 'showtweets', 2, true, false, false, '', false, handleTweets, false);

                            function handleTweets(tweets){
                                var x = tweets.length;
                                var n = 0;
                                var element = document.getElementById('showtweets');
                                var html = '<ul>';
                                while(n < x) {
                                  html += '<li>' + tweets[n] + '</li>';
                                html += '</ul>';
                                element.innerHTML = html;
                    <p>Follow us <b>@shayandoust</b></p>
                </div><!-- /col-lg-3 -->

                <!-- LATEST POSTS -->
                <div class="col-lg-3">
                    <h4>Latest Posts</h4>
                        <i class="fa fa-angle-right"></i> Just opened the service!<br/>

                </div><!-- /col-lg-3 -->

            </div><! --/row -->
        </div><!-- /container -->
    </div><!-- /f -->

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/retina.js"></script>

        $(window).scroll(function() {
            var imagePos = $(this).offset().top;

            var topOfWindow = $(window).scrollTop();
                if (imagePos < topOfWindow+400) {



$username = $_POST['username'];
$password1 = $_POST['password1'];
$email = $_POST['email'];

$con=mysqli_connect("db4free.net","-CENSORED USERNAME-","-CENSORED PASSWORD-","projectbook");
// Check connection
if (mysqli_connect_error()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();

mysqli_query($con,"INSERT INTO member (name, password, email)
VALUES ('$name', '$password', '$email')");



2 Years
Discussion Span
Last Post by matrixdevuk

User firefox with firebug->console to see if any errors are shown. In your mysqli connection, try changing to localhost or


Just a few thoughts:

  • you should check if all the required values exist before using them in the query (otherwise the query might break)
  • you should sanitize the values before using them in the query (otherwise you could pass some nasty user supplied data to your DB server than can compromise security)
  • you should hash the password and store / use the hashed value (so users are ensured they have full control over their access)

This is example code (it can be improved, but is simplified to show what I meant):

// if any of the data is missing redirect to some error page or back to the form
    !isset($_POST['username']) || empty($_POST['username']) ||
    !isset($_POST['password1']) || empty($_POST['password1']) ||
    !isset($_POST['email']) || empty($_POST['email'])
  ) {
      header("location: error.php");
// sanitize the data
$username = mysqli_real_escape_string($_POST['username']);
// use crypt or similar to hash the passwords
$password1 = some_hashing_method_here($_POST['password1']);
$email = $password1 = mysqli_real_escape_string($_POST['email']);

Edited by broj1


Try adding these lines to the top of your PHP script to make sure errors show up:

define('DEBUG', true); // change true to false to disable errors showing up
if(DEBUG) {
  ini_set('display_errors', 1);
} else {
  ini_set('display_errors', 0);
error_reporting(E_ALL & ~E_NOTICE);

This might help you track down the error if the they are being hidden from you for some reason.

Also try to var_dump your variables to see if they have the values you expect. Combined and expanded with broj1's good recommendations this might look like this:

// sanitize the data - unless you use mysqli_prepare (mentioned again
// a few lines down) - NEVER access $_POST or $_GET without passing
// the value through mysqli_real_escape_string() or crypt() first.
// even if you do use mysqli_prepare, always use crypt() for passwords!
$username = mysqli_real_escape_string($_POST['username']);
// TODO: change second string ('*D') passed to crypt() to something unique to your
// site. if you have PHP 5.5 use password_hash instead of crypt.
$password1 = crypt($_POST['password1'], '*D'); 
//$password1 = password_hash($_POST['password1'], PASSWORD_DEFAULT);  // PHP 5.5 only
$email = mysqli_real_escape_string($_POST['email'])

echo "<br/>Username =";
echo "<br/>Password ="; // remember this will be a long string hash, that's good!
echo "<br/>Email =";

// prepare the query from sanitized data
// TODO/SECURITY RISK: instead of concatenating strings from user
// supplied values, you should consider using mysqli_prepare
// (see http://php.net/manual/en/mysqli.prepare.php) in which case
// mysqli_real_escape_string would no longer be required above
$sql = "INSERT INTO member (name, password, email) VALUES ('$name', '$password1', '$email')"

echo "<br/>SQL = ";

// call the prepared query

Edited by Isaac_4

Votes + Comments
Nicely explained

try these steps..
1) First check that your database column name is same as you enter in the query.

2) fix your query to this...

$smt=mysqli_query($con,"INSERT INTO member (name, password, email)VALUES('".$name."', '".$password."', '".$email."')");
do something here
show error here
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.