I am fetching data from my sql it gives the error here is the my code
<?php
$con = mysql_connect("productivo.db.6420177.hostedresource.com","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("productivo", $con);
$username=$_POST['UserName'];
$password=$_POST['UserPassword'];
echo($u);
echo($pw);
$query = "SELECT * from UserCredentials WHERE UserName='$username' AND UserPassword='$password'";
//$con = mysql_query($query,$con); //$cnt = mysql_num_rows($con);
$res = mysql_query($query,$con);
$cnt = mysql_num_rows($res);
echo($cnt);
if($cnt ==0) { echo "Login Failed"; } else { echo "Yes Successful Login" ; } ?>
here is the warning it shows
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/CheckUserCredentialsAPI.php on line 21 Login Failed
you can accees using this url
http://celeritas-solutions.com/pah_brd_v1/productivo/CheckUserCredentialsAPI.html
MySQL(mysql_ functions) extension is *deprecated. I suggest to useMySQLi(mysqli*_ functions) orPDOinstead.