My sql + php query help?

Mentaljason

New member
In short this is my selection of php:

if(isset($_POST['encode']))
{
$q=mysql_query("SELECT * FROM *cencor* WHERE text='{$_POST['encode']}'");
if(mysql_num_rows($q))
{
print "Data encoded, but already in the database.</body>";
}
else
{
print "Thank you for adding data to our dictionary. The data was entered into the database sucessfuly.
<br />Thank you for adding this string to our decode database.";

mysql_query("INSERT INTO *cencor* (sha1, sha256, md5, snefru, whirlpool, gost, text)
VALUES('sha1('{$_POST['encode']}'), sha256('{$_POST['encode']}'), md5('{$_POST['encode']}'), snerfru('{$_POST['encode']}'), whirlpool('{$_POST['encode']}'), gost('{$_POST['encode']}'), ('{$_POST['encode']}')')");
print "</body>";
}
}

I tried with the $q num rows to decide weather too add to database (If it's not already there)
or not add is there is rows with the same data, but this just keeps adding....and not moving to the else if it's in, did i mess up the num rows part?

Please help
 
Back
Top