检索列数据从mysql和显示在HTML格式的动态列表视图?mysql新手& &;php
retrive column data from mysql and display in dynamic list view in HTML form?newone to mysql & php
从mysql数据库中检索名称列,并在HTML表单的动态列表视图中显示,同时单击列表的名称,它显示其他详细信息(年龄,性别,地址)为其他HTML表单....中选择的名称
你可以从下面的例子中获得灵感
创建数据库连接// Here 'inmoti6_myuser' is username and password is 'mypassword'
$con = mysql_connect("localhost","inmoti6_myuser","mypassword");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
// We now need to select the particular database that we are working with
// In this example,database named inmoti6_mysite
mysql_select_db("inmoti6_mysite", $con);
2)写查询获取用户的姓名和电子邮件
$query = "SELECT name,email FROM `users` ";
// Now that we have our Query, we will run the query against the database
// and actually grab all user's name and email
$data = mysql_query($query);
// We are now ready to print name. Below we will loop through our
// data and print them one by one.
// The while statement will begin the "looping"
while($row = mysql_fetch_array($data, MYSQL_ASSOC)) {
// for example, to print the user's name, we would use:
$name = $row['name'];
//to print the user's email, we would use:
$email = $row['email'];
echo
"<div style='margin:30px 0px;float:left:width:100%'>
Name: $name<br />
Email: $email<br />
</div> ";
}
mysql_close($con);
相关文章:
- 如何使用javascript从主svg对象动态创建svg视图框
- 正在使用$location.path(.)路由ng视图
- angular.js没有'无法在PhoneGap中处理视图标记
- 如何包含特定于每个视图angularjs的javascript文件
- 使用jquery将mysql数据获取到新的表行中
- 通过在Dojo mobile ViewController.openExternalView中动态更改打开同一外部视图的
- Kendo:我该如何在树视图中创建一个递归的hieiarchy
- Ajax Live搜索发布到Laravel视图
- backbone.js无法渲染视图
- 根据某些条件在视图之间切换
- ng视图外的链接重定向到ng视图内的页面
- 如何在Jquery中发布后将值从视图返回到控制器
- 将日期时间作为 JSON 发送将无法在我的视图中正确显示
- 使用Scala Play Framework视图中的键检索映射值
- FF视图源|脚本高亮显示为红色
- 来自mysql的动态值用于html代码点火器视图中的图形
- 如何使用Loopback自动创建MySQL视图
- 如何将查询结果数据传递到Express.js和Mysql中的视图
- 如何创建视图和获取数据mysql PHP javascript
- 检索列数据从mysql和显示在HTML格式的动态列表视图?mysql新手& &;php