Register.php
<head> <meta http-equiv="Content-Type" content="text/html; charset+utf-8" /> <link rel="stylesheet" type="text/css" href="ext/css/style.css" /> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $ (document).ready(function() { $('#username_feedback').load('../../core/inc/register_checks.inc.php').show(); $('#username').keyup(function(){ $.post('../../core/inc/register_checks.inc.php', { username: user_register.username.value }, function(result) { $('#username_feedback').html(result).show(); }); }); }); </script> <title><?php echo $page_title ?></title> </head> <body> <div> <?php if (empty($errors) === false) { ?> <ul> <?php foreach ($errors as $error){ echo "<li>{$error}</li>"; } ?> </ul> <?php } ?> </div> <form name="user_register" action="" method="post"> <p> <label for"username">Username:</label> <input type="text" name="username" id="username" value="<?php if (isset($_POST['username'])) echo htmlentities($_POST['username']); ?>"> <div id="username_feedback"></div>register_checks.php WORKING
<?php mysql_connect('localhost', 'root', ''); mysql_select_db('advertise'); $username = mysql_real_escape_string($_POST['username']); $check = mysql_query("SELECT user_name FROM users WHERE user_name='$username'"); echo $check_num_rows = mysql_num_rows($check); ?>register_checks.php NOT WORKING
<?php include('../init.inc.php'); $username = mysql_real_escape_string($_POST['username']); $check = mysql_query("SELECT user_name FROM users WHERE user_name='$username'"); echo $check_num_rows = mysql_num_rows($check); ?>I changed some database details around in the init.inc.php file and I was getting errors back in my register.php file about connecting to the DB so the register_checks.php is using the init.inc.php file to 'import' the DB credentials just for some reason its not outputting my SQL query.