【发布时间】:2017-08-02 10:21:39
【问题描述】:
我有一个文件 checkbalance.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CHECK BALANCE</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<img class="image" src="BITCOIN.jpg" height="100" width="100%" />
<ul class="nav" id="">
<li><a href="navbar.html">Home</a></li>
<li><a href="aboutus.html">About Us</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="logout.html">Logout</a></li>
</ul>
<ul class="nav2">
<li><a href="myprofile.html">My Profile</a></li>
<li><a href="">Order Chequebook/Passbook</a></li>
<li><a href="">Transactions</a></li>
<li><a href="">EFT</a></li>
<li><a href="">Change Password</a></li>
</ul>
<?php
$con=mysqli_connect('localhost','root','') or die("Failed to connect to
MySQL: " . mysql_error($con));
//select db
$db=mysqli_select_db($con,'sample1') or die("Failed to connect to MySQL:
MySQL: " . mysql_error($con));
$query="SELECT BALANCE FROM ac_holders WHERE username='$_POST[username]'";
$data = mysqli_query ($con,$query)or die(mysql_error());
$row = mysql_fetch_array($data);
$bal=$row['BALANCE'];
?>
<div class="text">
</br></br>
<h1> Your account balance is Rs.<?php echo $bal;?>
</h1>
</br>
</div>
</body>
</html>
在这里我无法在里面的网页上显示我的余额
标签使用 phpHere's an image of the webpage 的 echo 功能。唯一显示的是:您的帐户余额为卢比。
提前致谢!!!!!!
【问题讨论】:
-
不要混用
mysqli_*和mysql_*。还有sql注入。 -
请更准确我是 php 和 html 的新手
-
mysql 和 mysqli 在其他文件中工作