gpt4 book ai didi

php - 在 Php 中只显示我的整数值的第一位

转载 作者:行者123 更新时间:2023-11-29 01:55:56 25 4
gpt4 key购买 nike

我在获取数据库中整数的准确值时遇到问题,因为当我获取它的值时,只有它的整数的第一位显示在 php 中。例如,我数据库中的整数值是“11”,只有“1”显示在我的 php.ini 中。这是我的查询。

$count=0;
$query="SELECT id from register";
$result = mysql_query($query);
('error in query:$query. ' .mysql_error());

if(mysql_num_rows($result)>0){
while($row=mysql_fetch_assoc($result)){
extract($row);
$id[$count]=$id;
$count++;
}
}
for($x=0; $x<$count; $x++){
echo"".$id[$count];
}

最佳答案

试试这个:

$count=0;
$query="SELECT id from register";
$result = mysql_query($query);
('error in query:$query. ' .mysql_error());

if(mysql_num_rows($result) > 0) {
while($row = mysql_fetch_assoc($result)) {
$id[$count++] = $row['id'];
}
}

for($x=0; $x<$count; $x++) {
echo $id[$count];
}

关于php - 在 Php 中只显示我的整数值的第一位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29406432/

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