Here I want to assign $part1
and $part2
value into Mysqli query. But what is the problem is $part2
value does not get into query. I could not be able to find what would be the wrong with my code.
$string = 'Enter a domain name' . "
";
socket_write($client, $string, strlen($string)) or die("Could not write output
");
$str = '';
while ($input = socket_read($client, 1024)) {
$str .= $input;
if (strpos($str, "
") !== false) {
break 1;
}}
$part = explode(".", $str);
$part1 = $part[0];
$part2= $part[1];
$sql = "SELECT DomainCategory.Name "
. "FROM DomainName_Client, DomainNameType, DomainCategory, OrderDomain_Client "
. "WHERE DomainName_Client.Name='$part1' "
. "AND DomainNameType.Name='$part2' "
. "AND DomainName_Client.TypeID=DomainNameType.ID "
. "AND DomainCategory.ID=DomainName_Client.DomainCategoryID "
. "AND OrderDomain_Client.DomainNameID=DomainName_Client.ID";
$result = $mysqli->query($sql);
$row1 = $result->num_rows;
if ($row1 > 0) {
$row = $result->fetch_array(MYSQLI_NUM);
printf("%s
", $row[0]);
} else {
echo 'This is not a Registered Domain';
}