樹心幽徑

« 20181217在ubuntu 1604裝mysql server | Main | 20181219建立selldb資料庫、建立custs資料表、加入三筆資料錄至custs中、列出custs中的資料錄的PHP程式(m2.php)。 »

20181218mysql資料庫連線查詢網頁程式 a1.php (用來列出selldb資料庫中custs資料表的第1筆資料)
2018/12/18,14:57

<body bgcolor=cyan>

<img src=dog.png width=100>

<?php

$con = mysqli_connect('localhost', 'root', 'abc123abc123', 'selldb');

$sql= "select id,name,amount,tel from custs";

$query     = mysqli_query($con, $sql);
$row = mysqli_fetch_array($query);

echo  $row['id'] . ":" . $row['name'] . ":" . $row['amount'] . ":" . $row['tel'] . "<br>";

$row = mysqli_fetch_array($query);echo  $row['id'] . ":" . $row['name'] . ":" . $row['amount'] . ":" . $row['tel'] . "<br>";
?>

 

</body>

 

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType