现在的问题是,代码无法检查用户名是否已被占用,是否有任何代码可以检查用户名已经在数据库中?
我正在试验我的一些代码,然后可能在Stack Overflow中搜索了这个问题.我试过这个解决方案,但显然它给了我错误.当我试过它时,警告:
mysql_query()期望参数2是资源,C:...在线给出的对象...
和问题
mysql_num_rows()期望参数1是资源,在C中给出null:...在线...
我实际上正在寻找这个问题的解决方案或教程如何解决这个问题.
我的代码:
<?php
require_once("functions.php");
require_once("db-const.php");
session_start();
if (logged_in() == true) {
redirect_to("profile.php");
}
?>
<?php
?>
<html>
<head>
<title>Prospekt Member Area</title>
</head>
<body>
<h1> Register Here </h1>
<h2>© Kirk Niverba</h2>
<hr />
<!-- The HTML registration form -->
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
First name: <input type="text" name="first_name" /><br />
Last name: <input type="text" name="last_name" /><br />
Email: <input type="type" name="email" /><br …Run Code Online (Sandbox Code Playgroud) 当我将我的代码运行到我的localhost时,它只是做得很好,但当我把它放在我的" webhoster "(000Webhost,免费版)上时.错误
解析错误:语法错误,第7行/home/a5532550/public_html/login/db-const.php中的意外T_CONST
只是出现了.服务器使用的是5.2版本的PHP .*,Apache版本2.2.19(Unix)和MySQL版本5.1
DB-Const代码
<?php
const DB_HOST = ------;
const DB_USER = ------;
const DB_PASS = ------;
const DB_NAME = ------;
?>
Run Code Online (Sandbox Code Playgroud)