简体   繁体   English

如何使用PHP在MySQL中捕获搜索索引?

[英]How do I capture search index in MySQL using PHP?

I do have table table1 with two columns say name and details when I search by details there were multiple name listing. 当按details搜索时,我确实有具有两列的表table1 ,分别说namedetails details其中有多个名称列表。 I want to retrieve that name list and display to a webpage using PHP. 我想检索该名称列表并使用PHP显示到网页。 how can I do that? 我怎样才能做到这一点?

the most basic page.php: 最基本的page.php:

<?php
$sql = mysql_query('SELECT name FROM table1 WHERE details = "something"');
$result = array();
while($row = mysql_fetch_assoc($sql)){
  array_push($result,$row['name']);
  echo $row['name'].'<br />';
}
print_r($result);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM