columbo1977
Programmer
Good Evening
I have created a server behaviour in Dreamweaver to check if a username exists when someone registers at the site.
When i click submit i get the following errors?
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in c:\webserver\phpdev5\ on line 8
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\webserver\phpdev5\ on line 9
the code for the checking is below
<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="denied_u.html";
$loginUsername = $_POST['username'];
$LoginRS__query = "SELECT Username FROM users WHERE Username='" . $loginUsername . "'";
mysql_select_db($database_null, $null);
$LoginRS=mysql_query($LoginRS__query, $null) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
Can anyone help as to why the errors come up.
Cheers
Columbo1977
I have created a server behaviour in Dreamweaver to check if a username exists when someone registers at the site.
When i click submit i get the following errors?
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in c:\webserver\phpdev5\ on line 8
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\webserver\phpdev5\ on line 9
the code for the checking is below
<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="denied_u.html";
$loginUsername = $_POST['username'];
$LoginRS__query = "SELECT Username FROM users WHERE Username='" . $loginUsername . "'";
mysql_select_db($database_null, $null);
$LoginRS=mysql_query($LoginRS__query, $null) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}
Can anyone help as to why the errors come up.
Cheers
Columbo1977