$query1 = "select * from f_words where engword ='".$en_word."'";
$result1 = mysql_query($query1);
if(mysql_num_rows($result1))
{
$query2 = "update f_words set mrword ='".$mr_word."' where engword ='".$en_word."'";
$result2 = mysql_query($query2);
if (mysql_num_rows($result2))
{
echo mysql_affected_rows()." word updated.<br><br>";
echo "<u><a href='addnew.html'>add again</a></u>";
}
else
echo " Can't added to database.";
}
else
{
$query3 = "insert into f_words ('engword','mrword') values ('".$en_word."','".$mr_word."')";
$result3 = mysql_query($query3);
if (mysql_num_rows($result3))
{
echo mysql_affected_rows()." word added.<br><br>";
echo "<u><a href='addnew.html'>Add again</a></u>";
}
else
echo "Can't added to database .";
}
I am getting error as :
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
In this script if word is already available, then it's meaning should updated, if word not in the database, it should be added.
Please, help me with this code.