我正在从我的 sql 中获取数据,它给出的错误是我的代码
<?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" ; } ?>
这是它显示的警告
警告:mysql_num_rows():在第 21 行的 /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/CheckUserCredentialsAPI.php 中提供的参数不是有效的 MySQL 结果资源 登录失败
您可以使用此网址访问
http://celeritas-solutions.com/pah_brd_v1/productivo/CheckUserCredentialsAPI.html