gpt4 book ai didi

php - Mysql 查询结果

转载 作者:行者123 更新时间:2023-12-01 00:24:11 24 4
gpt4 key购买 nike

我的mysql查询结果示例在这里;

    id = 45
species = Felis
generic = Leo
labidenlabel = S131
accessnumber = 4545
specimen = Blood
storedas = DNA
storedat = aDNA
storin = Beko Refrigerator

我想看到他们喜欢;

        id = 45
species Name = Felis
generic Name = Leo
labiden Label = S131
Access number = 4545
specimen = Blood
stored As = DNA
stored At = aDNA
store In = Beko Refrigerator

等等

还有我的 php 代码,我想更改结果区域。不是mysql字段,需要看具体名称。

抱歉我的英语不好...

   <?php
error_reporting(1);
$speci1=$_GET['id'];

$baglan=mysql_connect("localhost","root","");
if(!$baglan){
die('Bağlantı Hatası:' . mysql_error());
}
$sec=mysql_select_db("test",$baglan);

$sql= "SELECT * from bilgiler where id='$speci1'";


$sorgu=mysql_query($sql,$baglan);
if(mysql_num_rows($sorgu) > 0){
$satir=mysql_fetch_assoc($sorgu);

foreach ($satir as $key => &$value) {

echo $key . ' = ' . $value . '<br />';
}
}else{
echo "Kayıt Bulunamadı!";
}
?>

如何更改结果页面?谢谢。

最佳答案

使用 mysql alias .而不是

select * from

使用

select id, species as 'species Name', ... from

关于php - Mysql 查询结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17567750/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com