Hi all,

I have this admin site where the administrators can add new ones of
their kind (admin level) and now I'm trying to make a query so no
usernames are duplicated in MySQL.

The query goes like this:

$query1 = "SELECT * FROM r2k_admin WHERE adminuser = $user";
$result1 = mysql_query($query1);
$num_rows = mysql_num_rows($result1);

$errors=0;
if ($num_rows == 0)
{
$query = "INSERT INTO r2k_admin (adminid, adminname, adminemail,
adminuser, adminpassword) VALUES (NULL, '$name', '$email', '$user',
password('$pass'))";
$result = mysql_query($query) or die(mysql_errno());
}
else if ($num_rows > 0)
{
$errors++;
}

But the PHP part of the program tells me that I have an error in my
MySQL syntax in the line where $num_rows is declared, right after the
first query. Anyone knows what's this all about?

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to