doujin8476 2018-12-03 18:51
浏览 52

使用PHP,在PHP MySql表中插入数据。 并在html正文中显示该表

i tried to insert data in a table i have created in DB. the data is supposed to show in the table. i'm not sure if i have errors. i tried ti fix many times. and i want to show it on html body after clicking on the button but i don't know how. i appreciate your help

<div align="center" id="Style2">
    <label class="Button1">
    <a href="YU Database -Home Page.html" class="Button2" role="button">Home</a>&nbsp;&nbsp;&nbsp;&nbsp;
    <button type="submit" class="Button2" role="button">Maintain Employee</button>&nbsp;&nbsp;&nbsp;&nbsp;
    <button type="submit" class="Button2" role="button" name="input66">Display Employee</button>&nbsp;&nbsp;&nbsp;&nbsp;
    <button type="submit" class="Button2" role="button">Log Out</button>
</label></div>

    <?php 
//Config.php
//Config.php file is having information about MySQL Data base configuration.
$servername = "localhost";
$username = "root";
$password = "123456";
$dbname = "yudb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);}

$sql = "INSERT INTO member (UserName, Password) VALUES ('Mariam', 'Mariam123')";
$sql = "INSERT INTO member (UserName, Password) VALUES ('Mohammed', 'Mohammed123');";
$sql = "INSERT INTO member (UserName, Password) VALUES ('Abdullah', 'Abdullah123');";
$sql = "INSERT INTO member (UserName, Password) VALUES ('Fatima', 'Fatima123')";

$sql = "INSERT INTO employee (EmployeeID, EmployeeName, Designation, ExtentionNO.) VALUES ('1000', 'Peter','Project Manager','71082')";
$sql = "INSERT INTO employee (EmployeeID, EmployeeName, Designation, ExtentionNO.) VALUES ('1001', 'James','Technical Architect','71070');";
$sql = "INSERT INTO employee (EmployeeID, EmployeeName, Designation, ExtentionNO.) VALUES ('1002', 'Smith','Technical Architect','71022');";
$sql = "INSERT INTO employee (EmployeeID, EmployeeName, Designation, ExtentionNO.) VALUES ('1003', 'Mathew','Software engineer','71026')";
$sql = "INSERT INTO employee (EmployeeID, EmployeeName, Designation, ExtentionNO.) VALUES ('1004', 'Mary','Project Manager','71034')";



if ($conn->multi_query($sql) === TRUE) {
    echo "New records created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();

?>
</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度