I'm an outsider for the php with MySQL.
For my below code is testing : http://www.findoutbusiness.com/company/index.php?crno=1
How to write php code for the below questions:
How to write a code in order can support utf-8 / Chinese? Because now the Chinese company is showing "?????" only. The phpMyAdmin - database is can support Chinese. ONLY the index.php cannot support Chinese.
How to write a code for calculating the days ?
If the Active Status is "Dissolved", then calculate "Date of Dissolution - Date of Incorporation"
If the Active Status is "Live", then calculate "today - Date of Incorporation"
I want to show the company is running how many: ? year ? months ? days.
Thank you very much for your help & support !
<?php
$servername = "localhost";
$username = "abc";
$password = "abc1234";
$dbname = "company";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// select data
$sql = 'SELECT * FROM ComData WHERE com_no = '. $_GET['crno'];
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$pageTitle = $row['com_eng_name'] . $row['com_chi_name'];
$com_no = $row['com_no'];
$com_eng_name = $row['com_eng_name'];
$com_chi_name = $row['com_chi_name'];
$com_type = $row['com_type'];
$date_of_incorp = $row['date_of_incorp'];
$active_status = $row['active_status'];
$date_of_dissolution = $row['date_of_dissolution'];
$remarks = $row['remarks'];
}
} else {
echo "No Results";
}
$conn->close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="rights" content="www.findoutbusiness.com" />
<title><?php echo $pageTitle; ?> - Hong Kong Company Information</title>
</head>
<body >
<h2 >Hong Kong Company Information</h2>
<form action="http://www.findoutbusiness.com/company/index.php" id="cse-search-box">
<input type="text" name="crno" size="10" />
<input type="submit" value="Company Code Search" />
</form>
<br>
<table border="1" cellspacing="1" cellpadding="1">
<tr>
<td><strong>CR No.:<br>公司編號:</strong></td>
<td><?php echo $com_no; ?></td>
</tr>
<tr>
<td><strong>Company Name:<br>公司名稱:</strong></td>
<td><?php echo $com_eng_name; ?> <?php echo $com_chi_name; ?> </td>
</tr>
<tr>
<td><strong>Company Type:<br>公司類別:</strong></td>
<td><?php echo $com_type; ?></td>
</tr>
<tr>
<td><strong>Date of Incorporation:<br>成立日期:<br></strong></td>
<td><?php echo $date_of_incorp; ?></td>
</tr>
<tr>
<td><strong>Active Status:<br>公司現況:</strong></td>
<td><?php echo $active_status; ?></td>
</tr>
<tr>
<td><strong>Date of Dissolution:<br>已告解散日期:</strong></td>
<td><?php echo $date_of_dissolution; ?></td>
</tr>
<tr>
<td><strong>Remarks:</strong></td>
<td><?php echo $remarks; ?></td>
</tr>
</table>
<br><br>
The company <?php echo $days; ?> days
<br>
<b>
<a href="index.php?crno=<?php echo ($_GET['crno'] - 1); ?>" >Previous Company</a> |
<a href="index.php?crno=<?php echo ($_GET['crno'] + 1); ?>" >Next Company</a>
</b>
<br><br>
<form action="http://www.findoutbusiness.com/company/index.php" id="cse-search-box">
<input type="text" name="crno" size="10" />
<input type="submit" value="Company Code Search" />
</form>
</body>
</html>
</div>