I am trying to make a simple register form in PHP with a free host not localhost, to send me an activation mail. This is the content of connect.php
<?php
$dburl = "xxxx.freehostxxx.com";
$dbuser = "xxxx";
$dbpass = "xxxx";
$handle = mysql_connect($dburl,$dbuser,$dbpass);
mysql_select_db("userdb", $handle);
?>
Before I this error, I found a solution on SO for Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
and I added in my every SELECT or die (mysql_error());
and now I keep getting this error. On localhost everything works fine. Database is imported, so I do not think I have a problem at that point.
<?php
if($_POST['registerbtn'])
{
$getuser = $_POST['user'];
$getemail = $_POST['email'];
$getpass = $_POST['pass'];
$getretypepass = $_POST['retypepass'];
if($getuser)
{
if($getemail)
{
if($getpass)
{
if($getretypepass)
{
if( $getpass === $getretypepass)
{
if( (strlen($getemail) >= 7) && (strstr($getemail, "@")) && (strstr($getemail, ".") ) )
{
require("./connect.php");
$query = mysql_query("SELECT * FROM userdb WHERE username =' $getuser '") or die (mysql_error());
$numrows = mysql_num_rows($query);
if($numrows == 0)
{
$query = mysql_query("SELECT * FROM userdb WHERE email = ' $getemail '") or die (mysql_error());
$numrows = mysql_num_rows($query);