so my code is this..
$password=(!isset($_POST['password']));
$username=(!isset($_POST['username']));
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$query = mysql_query ("SELECT * FROM tb_funcionario WHERE username='$username' and password='$password'");
$result = mysql_query($query);
var_dump($result);
$num_rows = $result->$num_rows;
if ($num_rows)
{
echo "username already exist";
}
else
{
$query = "INSERT INTO tb_funcionario (nome_funcionario, username, password) VALUES (
'$_POST[nome_funcionario]',
'$_POST[username]',
'$_POST[password]'
)";;
$result = mysql_query($query) or die (mysql_error());
}
mysql_query($query);
mysql_close($bd_con);
?>
And its always giving me the "mysql_query() expects parameter 1 to be string, resource given" and i cant figure out how to solve it.
Can yall help me?
No comments:
Post a Comment