im开发一个vb.net应用程序并尝试做一个Web服务来连接到我的服务器并检索Mysql数据,它是一个共享主机,因此当我的IP更改时,它不允许我远程连接,所以为什么我尝试这样做方法
这是我的代码
<?php
if(isset($_GET['username']) && isset($_GET['password']))
{
$connection = new mysqli($DB_IP, $DB_USER, $DB_PASSWORD, $DB_NAME);
if ($connection->connect_error)
{
die('Connect Error (' . $connection->connect_errno . ') '
. $connection->connect_error);
}
$username = $_GET['username'];
$query = $connection->query("Select u.*, p.* from users u, permisions p where u.IdUser = p.IdUser and username = '$username'");
$result = $query->fetch_array();
if($result)
{
$data['IsUser'] = 1;
$data['IsPassword'] = 1;
$data['Name'] = $result['NAME'];
$data['ApePat'] = $result['APEPAT'];
$data['ApeMat'] = $result['APEMAT'];
$data['Repo'] = $result['REPO'];
$data['Coti'] = $result['COTIO'];
$data['isAdmin'] = $result['ISADMIN'];
$data['UserType'] = $result['USERTYPE'];
$data['Expires'] = $result['EXPIRES'];
$data['Perm1'] = $result['PREM1'];
$data['Perm2'] = $result['PREM2'];
$data['Perm3'] = $result['PREM3'];
$data['Perm4'] = $result['PREM4'];
$data['Perm5'] = $result['PREM5'];
$data['Perm6'] = $result['PREM6'];
$data['Perm7'] = $result['PREM7'];
$data['Perm8'] = $result['PREM8'];
$data['Perm9'] = $result['PREM9'];
$data['Perm10'] = $result['PREM10'];
$data['Perm11'] = $result['PREM11'];
$data['Perm12'] = $result['PREM12'];
}
else
{
$data['IsUser'] = 0;
$data['IsPassword'] = 0;
}
echo json_encode($data);
}
else
{
echo 'Required parameter not provied';
}
?>
当我发送参数时发生错误,它在此行上给我错误500
$result = $query->fetch_array();
PHP致命错误:在布尔值上调用成员函数fetch_array()
这是即时通讯从vb.net发送值的方式
strReq = "http://gulsrv.com/dongle/getData.php?username=" & Uusername.ToString & "&&password=" & Ppassword.ToString
request = WebRequest.Create(strReq)
response = request.GetResponse()
dataStream = response.GetResponseStream()
reader = New StreamReader(dataStream)
strData = reader.ReadToEnd()
reader.Close()
response.Close()
知道为什么吗?如果我仅测试php文件,可以说需要提供参数